I have a Clib-based NLM that exports some...
Articles and Tips: qna
01 Jun 2003
Q.
I have a Clib-based NLM that exports some functions. The NLM has been made memory resident by doing ExitThread(TSR_THREAD,0). Now I want to port the same functionality into a LibC NLM. How would I do this?
A.
Use the following entry points for a library NLM:
entry: _LibCPrelude exit: _LibCPostlude
And add the following piece of code to your NLM:
#include <library.h> #include <windows.h> int DllMain (void *hinstDLL, unsigned long fdwReason, void *lvpReserved) { #pragma unused(lvpReserved) switch (fdwReason) { default: return FALSE; case DLL_NLM_STARTUP: register_destructor((int) hinstDLL, (int (*)(void *)) NULL); return TRUE; case DLL_NLM_SHUTDOWN: case DLL_PROCESS_ATTACH: case DLL_PROCESS_DETACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_ACTUAL_DLLMAIN: return TRUE; } return FALSE; }
That's all you need for a library NLM. Now you can export every API you want from your NLM.
* Originally published in Novell AppNotes
Disclaimer
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.