UnloadExternalModule

int UnloadExternalModule (int moduleID);

Purpose

Invalidates a module ID obtained from LoadExternalModule.

After UnloadExternalModule is called, you cannot access the module through GetExternalModuleAddr or RunExternalModule.

If the module file is not in the project and not loaded as an instrument module, UnloadExternalModule removes the external module file from memory.

Use ReleaseExternalModule instead of UnloadExternalModule when multiple calls might have been made to LoadExternalModule on the same module and you do not want to unload the module in case other parts of the application still use it.

Example

int module_id;
int status;
char *pathname;
pathname = "PROG.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 that LoadExternalModule returns, or -1.

If moduleID is -1, LabWindows/CVI unloads all external modules.

Return Value

Name Type Description
status_id integer The result of the operation.

Code Description
0 Success.
-5 Module cannot be unloaded because another external module that is currently loaded references it.
-9 Invalid module_id.