contents   index   previous   next



BUILDING AN EXTLIB

To build an extlib for your system, you should set up your compiler to build a new dll or shared object. The extlibs shipped with the ScriptEase ISDK have their appropriate makefiles/projects for you to look at if you have any questions. Include the base directory of the ScriptEase distribution as an include path in addition to any include paths needed for your extlib’s source files. Finally, link with the extlib library found in lib/extlibs/<system>/libsee501ar.a. The format of this file and its name is consistent with the format and name for the core and library versions described in the chapter on "Integration Into Your C/C++ Application".

 

The source code for the extlib itself is not an application. Instead you implement a few functions needed by the extlib framework provided in src\lib\common\selink.c. These functions allow your extlib to initialize itself on load. Usually, you will use the load as an opportunity to add new wrapper function tables to the context corresponding to the functionality of the extlib you are implementing. Therefore, in addition to the stock routines to be described next, you will have a number of wrapper functions implemented in the normal way as described in the chapter on "Wrapper functions".

 

For most operating systems, you need only define a single function in your extlib implementation. That function is defined as follows:

 

   SE_CALLBACK( sebool )

seExtensionLoadFunc(secontext se);

 

The function adds its function libraries to the context using seAddLibTable() and does any other initialization. It return TRUE to indicate success. A FALSE return will cause the extension library load to fail.

 

The exception is Netware. Because of the way Netware works, it must define two additional functions. The following code gives an example of these functions for the sesock extlib:

 

#if defined(__JSE_NWNLM__)

 

#ifdef _cplusplus

extern "C" {

#endif

 

   JSEEXTNSN_EXPORT(long)

sesockjseExtensionVer(secontext se)

{

  return seExtensionVer(se);

}

 

   JSEEXTNSN_EXPORT(sebool)

sesockjseLoadExtension(secontext se)

{

   return seLoadExtension(se);

}

 

#ifdef _cplusplus

}

#endif

#endif

 

The only change you must make is in the name of the two routines. sesock must be replaced with the name of your extlib. It must correspond exactly to the .nlm executable to which the extlib is built; you cannot rename NLM extlibs. If the name of the .nlm does not correspond to the name of these two routines, the extlib will fail to load.