久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

__declspec(dllimport) 的真正含義是什么?

what does __declspec(dllimport) really mean?(__declspec(dllimport) 的真正含義是什么?)
本文介紹了__declspec(dllimport) 的真正含義是什么?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我看到的Qt源代碼是這樣的:

I saw the Qt source code like this:

class Q_CORE_EXPORT QBasicAtomicInt
{
public:
...
};

Q_CORE_EXPORT 宏定義如下:

define Q_DECL_IMPORT __declspec(dllimport)

那么 __declspec(dllimport) 到底是什么意思?

So what does __declspec(dllimport) really mean?

推薦答案

__declspec 是 Microsoft 特定的屬性,允許您指定存儲類信息.
(Nitpicker's Corner:但是,許多其他編譯器供應商(例如 GCC)現在支持此語言擴展,以便與針對 Microsoft 編譯器編寫的已安裝代碼庫兼容.有些甚至提供額外的存儲類屬??性.)

可以指定的兩個存儲類屬性是 dllimportdllexport.這些向編譯器表明函數或對象是從 DLL 導入或導出(分別).

Two of those storage-class attributes that can be specified are dllimport and dllexport. These indicate to the compiler that a function or object is imported or exported (respectively) from a DLL.

更具體地說,它們定義了 DLL 到客戶端的接口,而無需模塊定義 (.DEF) 文件.大多數人發現使用這些語言擴展比創建 DEF 文件要容易得多.

More specifically, they define the DLL's interface to the client without requiring a module-definition (.DEF) file. Most people find it much easier to use these language extensions than to create DEF files.

出于顯而易見的原因,__declspec(dllimport)__declspec(dllexport) 通常是相互配對的.您使用 dllexport 將符號標記為從 DLL 導出,然后使用 dllimport 將該導出的符號導入另一個文件.

For obvious reasons, __declspec(dllimport) and __declspec(dllexport) are generally paired with one another. You use dllexport to mark a symbol as exported from a DLL, and you use dllimport to import that exported symbol in another file.

因此,并且因為在編譯 DLL 時和在使用 DLL 接口的客戶端代碼中通常使用相同的頭文件,定義一個在編譯時自動解析為適當屬性說明符的宏是一種常見模式-時間.例如:

Because of this, and because the same header file is generally used both when compiling the DLL and in client code that consumes the DLL's interface, it is a common pattern to define a macro that automatically resolves to the appropriate attribute specifier at compile-time. For example:

#if COMPILING_DLL
    #define DLLEXPORT __declspec(dllexport)
#else
    #define DLLEXPORT __declspec(dllimport)
#endif

然后用DLLEXPORT標記所有應該導出的符號.

And then marking all of the symbols that should be exported with DLLEXPORT.

據推測,這就是 Q_CORE_EXPORT 宏所做的,解析為 Q_DECL_IMPORTQ_DECL_EXPORT.

Presumably, that is what the Q_CORE_EXPORT macro does, resolving to either Q_DECL_IMPORT or Q_DECL_EXPORT.

這篇關于__declspec(dllimport) 的真正含義是什么?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數據?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環: for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環?)
Reusing thread in loop c++(在循環 C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環形?)
主站蜘蛛池模板: 中文字幕av久久爽av | 国产欧美日韩在线 | av女优天堂 | 国产伦精品一区二区三区视频网站 | 欧美午夜理伦三级在线观看 | 国产性hd | 成人短视频在线观看 | 在线一区二区三区四区 | 四虎影音 | 在线免费观看毛片 | 天天色网站| 国产黄在线观看 | 国产精品久久久久久无人区 | 欧美激情第二页 | 天天综合天天 | a毛片视频 | 一级毛片黄色 | 亚洲欧美在线观看 | 日产久久视频 | 成人看片免费 | 91精品国产99久久久久久红楼 | 日韩精品视频免费播放 | 欧美日韩小视频 | 国产精品福利在线 | 久精品视频 | 中文日韩欧美 | 午夜快播 | 巨骚综合| 黄色小视频免费观看 | 亚洲欧美在线观看 | 依人久久 | 成人做爰www看视频软件 | 亚洲视频区 | 亚洲午夜视频在线观看 | 久久狠狠干 | 黄色小视频免费看 | 国产精品久久午夜夜伦鲁鲁 | 视频一区在线观看 | 一区二区三区高清 | 特级黄色大片 | 国产午夜精品久久久久久久 |