LabWindows/CVI

Content Type
Programming Language
Current manual

ReleaseExternalModule

ReleaseExternalModule

int ReleaseExternalModule (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.

Decreases the reference count for a module loaded using LoadExternalModule or LoadExternalModuleEx.

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

When you call LoadExternalModule successfully on a module, the module reference count increments by one. When you call ReleaseExternalModule, the module reference count decrements by one.

If the reference count decrements to zero, the module ID is invalidated and you cannot access the module through GetExternalModuleAddr or RunExternalModule. If, in addition, the module file is not in the project and not loaded as an instrument, ReleaseExternalModule removes the external module from memory.

If you want to unload the module regardless of the reference count, call UnloadExternalModule rather than ReleaseExternalModule. Use ReleaseExternalModule 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.

Parameters

Input
Name Type Description
moduleID int Module ID you obtain from LoadExternalModule or LoadExternalModuleEx.

Return Value

Name Type Description
result int The result of the operation.

Code Description
> 0 Success, but the module was not unloaded. The value indicates the number of remaining references.
0 Success, and the module was unloaded.
-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 4.0 and later

Was this information helpful?