in project using server.dll , client.exe, have dllexport
ed server symbol server dll, , not dllimport
ed client exe.
still, application links, , starts, without problem. dllimport
not needed, then???
details:
i have 'server' dll:
// server.h #ifdef server_exports #define server_api __declspec(dllexport) #else #define server_api // =====> not using dllimport! #endif class server_api cserver { static long s; public: cserver(); }; // server.cpp cserver::cserver(){} long cserver::s;
and client executable:
#include <server.h> int main() { cserver s; }
the server command line:
cl.exe /od /d "win32" /d "_debug" /d "_windows" /d "_usrdll" /d "server_exports" /d "_unicode" /d "unicode" /d "_windll" /gm /ehsc /rtc1 /mdd /yu"stdafx.h" /fp"debug\server.pch" /fo"debug\\" /fd"debug\vc80.pdb" /w3 /nologo /c /wp64 /zi /tp /errorreport:prompt cl.exe /out:"u:\libs\debug\server.dll" /incremental:no /nologo /dll /manifest /manifestfile:"debug\server.dll.intermediate.manifest" /debug /pdb:"u:\libs\debug\server.pdb" /subsystem:windows /machine:x86 /errorreport:prompt kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
client command line:
cl.exe /od /i "..\server" /d "win32" /d "_debug" /d "_console" /d "_unicode" /d "unicode" /gm /ehsc /rtc1 /mdd /fo"debug\\" /fd"debug\vc80.pdb" /w3 /c /wp64 /zi /tp .\client.cpp cl.exe /out:"u:\libs\debug\debug\client.exe" /incremental /libpath:"u:\libs\debug" /manifest /manifestfile:"debug\client.exe.intermediate.manifest" /debug /pdb:"u:\libs\debug\debug\client.pdb" /subsystem:console /machine:x86 server.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
it isn't required. optimization, hint compiler dll going export function pointer directly rather entry in iat of dll. exported function pointer function named foo() __imp_foo. allows generate better code, saving function pointer load iat , indirect jump. time optimization, not space.
this blog post has details.
Comments
Post a Comment