zip's

while(true) { Write it down; Think about it; Refine it; Sleep(); }

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

在MFC DLL导出函数中传.net对象,不可以,有编译错误如下:

error C3395: 'MyClass::Function' : __declspec(dllexport) cannot be applied to a function with the __clrcall calling convention

 

解决方法是,为参数包上 gcroot<>.

class AFX_EXT_CLASS MyClass
{
public:
void Function(MyDotNetClass^ obj); //compile error
void Function(gcroot<MyDotNetClass^> obj); // this is correct
}

posted on 2010-11-19 16:03  zip's  阅读(1043)  评论(0编辑  收藏  举报