共用方式為


編譯器錯誤 C3385

'class::function' : 具有 DllImport 自訂屬性的函式不能傳回類別的執行個體

定義於使用 DllImport 屬性指定之 .dll 檔中的函式不能傳回類別的執行個體。

下列範例會產生 C3385:

// C3385.cpp
// compile with: /clr /c
using namespace System;
using namespace System::Runtime::InteropServices;

struct SomeStruct1 {};

public ref struct Wrap {
   [ DllImport("somedll.dll", CharSet=CharSet::Unicode) ]
   static SomeStruct1 f1([In, Out] SomeStruct1 *pS);   // C3385
};