Prepare the Win32 DLL for Use
| Overview | Details |
To prepare the DLL for use
-
On the Project menu, point to Add to Project, then click Files to add your source code files to the project.
-
If needed, add a function called DllMain and add the initialization and termination code for the DLL to this function.
-
Make sure you have exported the entry points to your DLL by using either the __declspec(dllexport) keyword or by listing the functions in the DLL’s .DEF file.
-
Prepare a header file that includes the programs using your DLL. This header file should contain the declarations of the appropriate functions. When the header file is compiled for a DLL, use the __declspec(dllexport) keyword to export from the DLL. When the header file is compiled for a program that uses the DLL, use the declspec(dllimport) keyword.
-
If your DLL uses __declspec(dllexport) or a .DEF file, an import library will be created automatically. In other situtations you will need to prepare an import library for your programs to link with by ensuring that the /IMPLIB linker switch is set when building your DLL.
-
Build the DLL.
What do you want to know more about?