|
From: Martin M. <vi...@gm...> - 2010-09-27 17:02:00
|
On Mon, Sep 27, 2010 at 4:10 PM, Edward Diener <eld...@tr...>wrote: > My experience with __declspec(dllimport) with VC++ is that a header file > automatically dllimports whatever is necessary when using a dll. Thta is > why I am not used to doing it manually. > I am not sure I understand correctly what you were meaning, but all that the __declspec(dllimport) does in VC++ is that it adds external symbol "__imp__<decorated name>" to resulting object file. Nothing more. You still have to specify .lib file which defines this symbol to linker command line (manually, or using #pragma comment(lib, "file"), or even #pragma comment(linker, "file.lib") ) In similar manner __declspec(dllexport) adds "/export:<name>" to object file's linkinfo (string which is appended to command line by linker). #pragma comment(lib, "file") adds "file.lib" to linker's command line, #pragma comment(linker, "string") adds whatever string you pass it (despite what MSDN claims), etc. |