To compile a dll you need to refer to your compiler manual. For Dev-Cpp or MS Visual C++ create a new project and select Win32 Dynamic-link library (dll).
If the module is a DLL not already mapped for the calling process, the system calls the DLL's DllMain function with the DLL_PROCESS_ATTACH value. If DllMain returns TRUE, LoadLibrary returns successfully. If DllMain returns FALSE, the system unloads the DLL from the process address space and LoadLibrary returns NULL.
It is not safe to call LoadLibrary from DllMain. For more information, see the Remarks section in DllMain.