共用方式為


連結器工具錯誤 LNK2028

函式 「function_containing_function_call」 中所參考的 「 exported_function 」 ( decorated_name ) ( decorated_name

備註

嘗試將原生函式匯入純映射時,請記住,原生和純編譯之間的隱含呼叫慣例不同。

Visual Studio 2015 中已淘汰 /clr:pure 編譯器選項,Visual Studio 2017 不支援。

範例

此程式碼範例會產生具有匯出原生函式的元件,其呼叫慣例會 隱含__cdecl

// LNK2028.cpp
// compile with: /LD
__declspec(dllexport) int func() {
   return 3;
}

下列範例會建立使用原生函式的純用戶端。 不過,/clr:pure 下的 呼叫慣例是 __clrcall 。 下列範例會產生LNK2028。

// LNK2028_b.cpp
// compile with: /clr:pure lnk2028.lib
// LNK2028 expected
int func();

int main() {
   return func();
}