编译器错误 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
};
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈