I have written the following code as a sample:
#include <stdio.h>
#include <windows.h>
#include <tchar.h>
extern "C" BOOL WINAPI DllMain(HINSTANCE arg_instance, DWORD arg_reason, LPVOID arg_reserved)
{
switch(arg_reason)
{
case DLL_PROCESS_ATTACH: puts("DllMain called for DLL_PROCESS_ATTACH"); break;
case DLL_PROCESS_DETACH: puts("DllMain called for DLL_PROCESS_DETACH"); break;
}
return TRUE;
}
Then I try to link it with the following command:
link DllWithEntryPoint.obj /DLL /ENTRY:DllMain
It gives me the following errors:
LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol main referenced in function __tmainCRTStartup something.dll : fatal error LNK1120: 1 unresolved externals
Where is my mistake and how can I link it correctly?