Writing the Source Code

The source code is written as a standard C program, using the Editor access calls described in the LPEXAPI.H file. The following is an example of a typical minimal external function:

/*                                                                       *
 *-----------------------------------------------------------------------*
 * DISCLAIMER OF WARRANTIES:                                             *
 *                                                                       *
 *   The following enclosed code is sample code created by IBM           *
 *   Corporation.  This sample code is not part of any standard IBM      *
 *   product and is provided to you solely for the purpose of assisting  *
 *   you in the development of your applications.  The code is provided  *
 *   "AS IS", without warranty of any kind.  IBM shall not be liable     *
 *   for any damages arising out of your use of the sample code, even    *
 *   if they have been advised of the possibility of such damages.       *
 *                                                                       *
 *-----------------------------------------------------------------------*
 *                                                                       */
 /****************************************/
 /*  LXMIN2.C - A minimal LPEX external  */
 /*             command in C or C++.     */
 /****************************************/

 #include "lpexapi.h"                /* include function definitions */

 int lxmain(uchr *parm)       /* lxmain() is the command entry point */
 {
    return 0;                                          /* do nothing */
 } 

Note that the program entry point is always the lxmain() function. You cannot use the main() function.