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

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

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

問題描述

我看到的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 特定的屬性,允許您指定存儲(chǔ)類信息.
(Nitpicker's Corner:但是,許多其他編譯器供應(yīng)商(例如 GCC)現(xiàn)在支持此語言擴(kuò)展,以便與針對(duì) Microsoft 編譯器編寫的已安裝代碼庫兼容.有些甚至提供額外的存儲(chǔ)類屬??性.)

可以指定的兩個(gè)存儲(chǔ)類屬性是 dllimportdllexport.這些向編譯器表明函數(shù)或?qū)ο笫菑?DLL 導(dǎo)入或?qū)С?分別).

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) 文件.大多數(shù)人發(fā)現(xiàn)使用這些語言擴(kuò)展比創(chuàng)建 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) 通常是相互配對(duì)的.您使用 dllexport 將符號(hào)標(biāo)記為從 DLL 導(dǎo)出,然后使用 dllimport 將該導(dǎo)出的符號(hào)導(dǎo)入另一個(gè)文件.

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.

因此,并且因?yàn)樵诰幾g DLL 時(shí)和在使用 DLL 接口的客戶端代碼中通常使用相同的頭文件,定義一個(gè)在編譯時(shí)自動(dòng)解析為適當(dāng)屬性說明符的宏是一種常見模式-時(shí)間.例如:

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標(biāo)記所有應(yīng)該導(dǎo)出的符號(hào).

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

據(jù)推測(cè),這就是 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.

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

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

相關(guān)文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數(shù)據(jù)?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環(huán): for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環(huán)?)
Reusing thread in loop c++(在循環(huán) C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環(huán)形?)
主站蜘蛛池模板: 精品国产一区二区在线 | 国产成人小视频 | 日本黄视频在线观看 | 国产视频第一页 | 国产一区在线视频 | 日韩欧美国产精品一区二区三区 | 日本电影韩国电影免费观看 | 伊人久久综合影院 | 日韩精品一区二区三区中文在线 | 欧美一级欧美三级在线观看 | 日日草夜夜草 | 日韩一区精品 | 视频一区二区中文字幕日韩 | 国产成人在线免费 | 6996成人影院网在线播放 | 噜噜噜噜狠狠狠7777视频 | 中文字幕亚洲欧美日韩在线不卡 | 亚洲精品视频一区二区三区 | 国产一区二区在线播放 | 91在线免费观看网站 | 国产精品国产成人国产三级 | 欧美亚洲视频在线观看 | 国产精品久久久久免费 | 国产精品精品视频一区二区三区 | 99久久婷婷国产综合精品电影 | 国产草草视频 | 99精品免费视频 | 国产电影一区二区在线观看 | 女生羞羞网站 | 九九热免费在线观看 | 粉嫩av| 亚洲一区久久 | 最新高清无码专区 | 欧美激情在线播放 | 亚洲高清免费 | www.三级 | 国产美女一区二区 | 99精品一区二区三区 | 成年人在线观看 | 91天堂 | avmans最新导航地址 |