Platform SDK: DLLs, Processes, and Threads

Freeing the Win32-based DLL

Be sure to free the Win32-based DLL using the FreeLibrary32W function before exiting the code that loaded the DLL (APP16 or DLL16). In APP16, you would make the following call.

// Free the Win32-based DLL from the 16-bit Windows-based application.
FreeLibrary32W( ghLib );

If you are isolating your thunking code into DLL16, you would put the call in your WEP function, if you put the call to the LoadLibraryEx32W function in your LibMain function.