There is no DLL template. It was omitted for no good reason :? .
Anyway, here's some sample code:
#include <windows.h>
#ifdef BUILD_DLL
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT
#endif
// a sample exported function
void DLL_EXPORT SomeFunction(const LPCSTR sometext)
{
MessageBoxA(0, sometext, "DLL Message", MB_OK | MB_ICONINFORMATION);
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
// attach to process
// return FALSE to fail DLL load
break;
case DLL_PROCESS_DETACH:
// detach from process
break;
case DLL_THREAD_ATTACH:
// attach to thread
break;
case DLL_THREAD_DETACH:
// detach from thread
break;
}
return TRUE; // succesful
}
Create a new empty project and add a source file containing the above code.
Go to project properties and change the "default" target's type to "Dynamic library". Adjust the output filename, if you want.
In the project's build options, add under "Compiler definitions" BUILD_DLL.
If you 're using the VC free toolkit, you will need to add to the project's build options, under the linker options, the two libraries user32.lib and kernel32.lib (you will have to have installed the MS Platform SDK).
HTH,
Yiannis.