SilverScreen Solid Modeler

Using a Win32 DLL

Using a Win32 DLL

Previous topic Next topic  

Using a Win32 DLL

Previous topic Next topic JavaScript is required for the print function  

SilverPlusEllipse

 

Using a Win32 DLL

 


If you choose to use a Win32 DLL, then you will need to provide a DllMain function.

 

 


The DllMain function is a requirement for Win32 DLLs. The DllMain function is called just after your DLL is loaded, and again just prior to its removal. DllMain is also called when the SilverScreen process creates or destroys a thread. DllMain is used to initialize the DLL; in particular, the C run-time library and some static C++ objects are initialized then, also, an important piece of data -- the instance (or module) handle for the DLL -- is passed to DllMain when the DLL is being loaded. The instance handle is necessary for loading other resources from the DLL module.

 

Note that under some uses of the MFC for DLLs, the DllMain function is hidden inside the MFC mechanisms.

 

 


The prototype for DllMain should match the following:

 

C / C++ Code

 

 extern "C" __declspec(dllexport) BOOL WINAPI

    DllMain(HINSTANCE hInstance,

            DWORD     dwReason,

            LPVOID    lpReserved)

 

 

The parameters have the following meanings:

 

Name

Description

hInstance

The DLL module handle, or the base address of the DLL.

dwReason

A value whose meaning is as follows:

 

Constant

Meaning

DLL_PROCESS_ATTACH

The DLL is being loaded into the virtual address space

DLL_PROCESS_DETACH

The DLL is being unloaded from the virtual address space

DLL_THREAD_ATTACH

The current process is creating a thread

DLL_THREAD_DETACH

A thread of the current process is exiting cleanly.

lpReserved

Reserved by Windows