LabWindows/CVI

Content Type
Programming Language
Current manual

UnloadExternalModule

UnloadExternalModule

int UnloadExternalModule (int moduleID);

Purpose

Note Note  This class of functions is deprecated. National Instruments recommends that you instead use the Windows SDK functions LoadLibrary and GetProcAddress to load external modules. These functions allow you to load Windows DLLs, but not compiled object modules or libraries.

Invalidates a module ID obtained from LoadExternalModule.

Note Note  This function is not supported for 64-bit applications.

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 Code

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 int The value that LoadExternalModule returns, or -1.

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

Return Value

Name Type Description
result int 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.

Additional Information

Library: Utility Library

Include file: utility.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later

Was this information helpful?