久久久久久久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久久久久久久 | 成人在线观看中文字幕 | 男女又爽又黄视频 | 欧美综合久久 | 91在线看网站| 亚洲精品乱码久久久久v最新版 | 亚洲精品久久久久久久久久久 | 超碰天天 | 国产激情毛片 | 亚洲视频在线播放 | 91污在线| 精品国产欧美一区二区三区成人 | 欧美亚洲一区二区三区 | 国产人久久人人人人爽 | 亚洲精品一区二区三区四区高清 | 中文字幕精品一区久久久久 | 久久精品 | 一区二视频| 亚洲视频免费 | 精品国产91乱码一区二区三区 | jizz视频| 精品久久久久久久久久久 | 黄网站色大毛片 | 免费看一区二区三区 | 成人免费视屏 | 欧美日韩精品一区二区三区视频 | www.天堂av.com | 成人午夜在线观看 | 一级片免费视频 | 国产最好的av国产大片 | 亚洲精品黄色 | 国产羞羞视频在线观看 | 日韩国产在线观看 | 精品乱码一区二区三四区视频 | 国产精品精品视频一区二区三区 | 久久av一区二区三区 | 在线欧美 | 黄色a三级 | 在线观看中文字幕dvd播放 | 奇米av| 国产免费一区二区三区 |