Functions and Directives

Function DllUnLoad() Foundation

Unloads a previously loaded DLL.

DllUnLoad( <nDllHandle>|<cDllName> ) --> lSuccess
<nDllHandle> is the numeric handle of a loaded DLL. It is the return value of the function DllLoad().
<cDllName> is a character string with the name of the DLL file to be unloaded. It must be specified if the DLL handle is not available.

The function DllUnLoad() returns .T. (true) if the DLL file is no longer available to the current process. In case of an error, the return value is .F. (false) and the error condition can be determined by the DosError() function.


DllUnload() unloads a DLL file, i.e. the DLL becomes unavailable to the current process. The function is only valid for the current process. If a DLL is used by other processes at the same time when DllUnload() is called, the DLL remains accessible for other processes.

If other DLLs are statically linked to the dynamically loaded DLL, the function DllUnload() executes all EXIT PROCEDUREs programmed in the statically linked DLLs.

When DLLs are built with Xbase++ and are to be loaded dynamically, all PRG files for that DLL must be compiled with the compiler option /dll:dynamic. Otherwise DllUnload() will raise a runtime error.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.