RunExternalModule

int RunExternalModule (int moduleID, const char *buffer);

Purpose

Calls the pre-defined entry point function in an external object module that was loaded using LoadExternalModule.

RunExternalModule requires that the module define the following function:

void _xxx_entry_point (char [])

where xxx is the base name of the file, in lowercase. For example, if the pathname of the file is C:\LW\PROGRAMS\TEST01.OBJ, the name of the entry point must be _test01_entry_point.

Example

int module_id;
int status;
char *pathname;
pathname = "EXTMOD.OBJ";
module_id = LoadExternalModule (pathname);
if (module_id <0)

FmtOut ("Unable to load %s\n", pathname);

else {

RunExternalModule (module_id, "");
UnloadExternalModule (module_id);

}

Parameters

Input
Name Type Description
moduleID integer The value returned by LoadExternalModule.
buffer const [] A buffer used to pass information to and from the external module entry point function.

Return Value

Name Type Description
result integer Indicates the result of the operation.

Code Description
0 Success.
-1 Out of memory.
-3 Entry point is undefined.
-4 Invalid file format.
-5 Undefined references.
-8 Cannot open file.
-9 Invalid module ID.
-25 DLL initialization failed, for example, DLL file not found.