使用dllexport时出错? [英] Error when using dllexport?
问题描述
我想通过使用dllexport导出功能.但是我在编译器错误C4439:'WrappedC':签名中具有托管类型的函数定义必须具有__clrcall调用约定"时遇到了错误.
I want to export the functions by using dllexport. But I encountered the error while compiler "error C4439: 'WrappedC' : function definition with a managed type in the signature must have a __clrcall calling convention".
我在头文件(.h)中的代码是:
My code in header file (.h) is:
extern "C"
{
__declspec(dllexport) int __stdcall ABC(int i);
__declspec(dllexport) char* __stdcall C(int i);
__declspec(dllexport) array<char>^ __stdcall WrappedC(int i) ;
}
我试图将_stdcall更改为__clrcall,但这会导致另一个错误:
I have tried to change _stdcall to __clrcall but it make another error:
error C3395: 'WrappedC' : __declspec(dllexport) cannot be applied to a function with the __clrcall calling convention
我已经在互联网上搜索了,但还没有解决.
I have searched on internet but i have not solved it yet.
谢谢
T& TGroup
T&TGroup
推荐答案
编译器已经几乎告诉您了问题所在.
The compiler has already pretty much told you what the problem is.
__declspec(dllexport) array<char>^ __stdcall WrappedC(int i)
由于该函数正在使用 clr
,因此您不能使用 __ declspec(dllexport)
.
You cannot use __declspec(dllexport)
due to the fact that that function is using clr
.
array< char> ^
几乎是它所抱怨的部分,因为它不是本机代码.
array<char>^
is pretty much the part it is complaining about as it's not native code.
这篇关于使用dllexport时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!