S
Simon Cheng
Hi,
I have a simple question of building a DLL as follows: (VC2003)
my_dll.h
======
#ifndef SHELL_DLL_API
#define SHELL_DLL_API extern "C" __declspec(dllimport)
#endif
SHELL_DLL_API VOID DoSomething();
my_dll.cpp
========
#include <windows.h>
#define MY_DLL_API extern "C" __declspec(dllexport)
#include "my_dll.h"
BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID) { return TRUE; }
VOID DoSomething() { return; }
Then I use the following cmdline:
cl /nologo /Od /Zi /DLL my_dll.cpp
And get the following result:
Shell_Dll.cpp
Creating library Shell_Dll.lib and object Shell_Dll.exp
LINK : fatal error LNK1561: entry point must be defined <----------
Supposedly the linker would use _DllMainCRTStartup as the default DLL entry?
Also, if I explicit specify the /ENTRY option, the linker doesn't recognize
it.
What am I missing?
Thanks,
Simon
I have a simple question of building a DLL as follows: (VC2003)
my_dll.h
======
#ifndef SHELL_DLL_API
#define SHELL_DLL_API extern "C" __declspec(dllimport)
#endif
SHELL_DLL_API VOID DoSomething();
my_dll.cpp
========
#include <windows.h>
#define MY_DLL_API extern "C" __declspec(dllexport)
#include "my_dll.h"
BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID) { return TRUE; }
VOID DoSomething() { return; }
Then I use the following cmdline:
cl /nologo /Od /Zi /DLL my_dll.cpp
And get the following result:
Shell_Dll.cpp
Creating library Shell_Dll.lib and object Shell_Dll.exp
LINK : fatal error LNK1561: entry point must be defined <----------
Supposedly the linker would use _DllMainCRTStartup as the default DLL entry?
Also, if I explicit specify the /ENTRY option, the linker doesn't recognize
it.
What am I missing?
Thanks,
Simon