共用方式為


DLL 匯入及匯出函式

Microsoft 特定的

如需此主題更完整及最新的詳細資訊,請參閱 dllexport、dllimport

dllimportdllexport 儲存類別修飾詞是 C 語言的特定延伸模組Microsoft。 這些修飾詞明確定義用戶端的 DLL 介面 (可執行檔或另一個 DLL)。 將函式宣告為 dllexport 即不需要使用模組定義 (.DEF) 檔。 您也可以搭配數據和物件使用 dllimportdllexport 修飾詞。

dllimportdllexport storage-class 修飾詞必須與擴充屬性語法關鍵詞搭配使用,__declspec如下列範例所示:

#define DllImport   __declspec( dllimport )
#define DllExport   __declspec( dllexport )

DllExport void func();
DllExport int i = 10;
DllExport int j;
DllExport int n;

如需擴充儲存類別修飾詞語法的特定資訊,請參閱擴充的儲存類別屬性

END Microsoft 特定的

另請參閱

C 函式定義