問(wèn)題描述
#if COMPILING_DLL
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __declspec(dllimport)
#endif
我如何/在哪里定義 COMPILING_DLL
?
How / where do I define COMPILING_DLL
?
見(jiàn)這里:__declspec(dllimport) 的真正含義是什么?
如果我不能使用相同的標(biāo)頭,聽(tīng)起來(lái)我根本就不能使用加載時(shí)動(dòng)態(tài)鏈接?
Sounds like I can't use load-time dynamic linking at all if I can't use the same header?
推薦答案
定義COMPILING_DLL=1
的最佳位置是編譯器的命令行.如果您使用 Visual Studio IDE,則它位于項(xiàng)目屬性 ... C/C++ ... 預(yù)處理器 ... 預(yù)處理器定義中.
Best place to define COMPILING_DLL=1
is command line of compiler. If you use Visual Studio IDE then it is in Project properties ... C/C++ ... Preprocessor ... Preprocessor Definitions.
__declspec(dllimport)
是 Microsoft 對(duì) C++ 的特定擴(kuò)展.Microsoft 擁有出色的在線(xiàn)文檔.
__declspec(dllimport)
is Microsoft specific extension to C++. Microsoft has excellent online documentation.
這篇關(guān)于dllexport/dllimport 開(kāi)關(guān)的宏的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!