Please enable JavaScript to view this site.

ESL Documentation

The source file contains the code for the functions or subroutines being defined within the DLL. There is no main function in a DLL. Each function or subroutine to be called by ESL must have its own entry point.

Note:        If your DLL will manipulate ESL string variables, you must include ESLLIB.H in your C source code file so that your DLL will have access to the string manipulation prototypes. For more information, refer to ESL String Data Type.

 

Some standard library functions cannot be called from DLLs. See your compiler manual or a standard library reference for more information.

 

You can usually find a workaround, for example, using _lwrite( ) instead of fprintf( ). If you have a problem using a C runtime library routine, test it by creating an executable program that contains main( ) that calls the problem C runtime library routine. If the new program works as expected and the DLL does not, the C runtime library routine is probably not callable from within a DLL.

 

All library modules should include the files ESLLib.h and Windows.h which are needed because they defines the macros APIENTRY, ESLSUBAPI and ESLFNCAPI. APIENTRY, ESLSUBAPI and ESLFNCAPI are the most convenient method to define each entry point into a DLL called by ESL. The macros defined in ESLLib.h should be used as follows:

MACRO

PURPOSE

ESLSUBAPI

External Subroutines

ESLFNCAPI

Functions

The macro APIENTRY should be used for all the remain entry point types required by ESL, which are:

Stimulus Library, initialization, termination and periodic checking routines,

Data conversion routines for external storage data types.

 

As the following example module uses ESL string values, the file ESLLIB.H has to be included. The example is written in C for use with the Microsoft Visual C++ compiler:

 

#include <windows.h>

#include <string.h>

#include "esllib.h"

 

LONG ESLFNCAPI AddOne(LONG value)

{

   return (1 + value);

}

 

HSTRING ESLFNCAPI CreateDummyString()

{

char *dummy = "dummy"; HSTRING hDummy;

 

   hDummy = EslCreateString(strlen(dummy), dummy);

   return (hDummy);

}

LONG ESLSUBAPI Increment(LONG *value)

{

   *value = *value + 1;

}