DllMain
- Updated2023-02-21
- 1 minute(s) read
Each DLL can have a DllMain function. The operating system calls the DllMain function with various messages. To generate the template for a DllMain function, select Edit»Insert Construct in a Source window.
Use caution when inserting code in the PROCESS_ATTACH and PROCESS_DETACH cases. In particular, avoid calling into other DLLs in these two cases. The order in which Windows initializes DLLs at startup and unloads them at process termination is not well defined. Thus, the DLLs you want to call might not be in memory when your DllMain receives the PROCESS_ATTACH or PROCESS_DETACH message.
It is always safe to call into the LabWindows/CVI Runtime in a DllMain function as long as you do so before calling CloseCVIRTE.