編譯器錯誤 C2492
'variable': 具有執行緒儲存期的資料可能不會有 dll 介面
變數是以線程屬性和 DLL 介面宣告。 變數的 thread
位址直到運行時間才知道,因此無法連結至 DLL 匯入或匯出。
下列範例會產生 C2492:
// C2492.cpp
// compile with: /c
class C {
public:
char ch;
};
__declspec(dllexport) __declspec(thread) C c_1; // C2492
__declspec(thread) C c_1; // OK