If your ESL application generates a crash report/dialog when the program exits, then a common cause that you need to investigation, is "Stack Corruption". This problem can be caused by using the wrong calling convention with external routines and functions. The Extended Call Interface (i.e. ECI) used to call all external functions requires the Standard Calling Convention, as used by the Windows System API's.
If you have written your own external routines, the calling convention will depend on whether the routine is called as an external subroutine, in which case the 'C' convention is used, or the routine is called as a function, when the standard calling convention must be used. To make the coding convenient; the following macros have been defined in the ESLLib.h supplied with the ESL Development tools edition;
ESLSUBAPI - For ESL subroutine application programming interface,
ESLFNCAPI - For ESL function application programming interface.
As all ESL subroutines pass the parameters via pointers, you must ensure all routines accept parameters as addresses. Passing parameters as a pointer, allows the values to be changed by the external routine. All external subroutines should return a LONG value, which can be referenced by the pseudo variable errorlevel.
Libraries written in Micro Focus COBOL use the 'C' convention by default.