When you review the DOSCMD project, you will notice that there are no entry points defined. This is because a local application is a separate executable, with the entry points already defined within the 'LOCAL.DLL'. The only required entry points within a local application are:
int EslMain(int argc, char * argv[])
void CleanUp(int termcode)
The EslMain acts as like a 'Main' in a normal program executable, receiving start-up parameters. The actual 'Main' routine is part of the LOCAL.DLL, which acts as the interface between the Esl program and the local application.
The CleanUp entry point is called during the termination of the local application, giving your program to perform any clean-up processing that is required before the application closes.
Data is received by the local application through a call to one of the following routines:
•"GetLine ( *char, int )"
•"GetCharacter ( void )"
You can also determine the size of the buffer to allocate, by calling
•"QueryInputCount(void)"
These routines must be within the main processing loop, whenever the local application is waiting for input. The GetLine call will suspend the local application until data is sent from the ESL application.
To send data back to the main ESL application your local application needs to use the PutString(buf) routine.
If as in DOSCMD, a special message is sent to exit the local application, then instead of calling the 'C' exit function or performing a return from the EslMain routine, your application must call the "ExitLocalApp(rc)" function, which allows the local application to perform its clean-up functions, including a call to your applications CleanUp routine.
When designing your local application, you should be aware that local application operate asynchronously from main ESL application, this has the advantage of allowing the ESL application to continue processing whilst the local application is waiting for a response from some system resource (e.g. a database).