[英]Have Unmanaged c++ code call managed c++ code that calls c# code
我在弄清楚究竟如何引用从非托管c ++代码调用c#代码的托管c ++代码时遇到了麻烦。 让我提出一些方案:
编译器错误为C2653。
这是我在做什么:
非托管C ++代码:我已将链接器设置为包括托管C ++ lib文件。
#include "ManagedCpp.h"
ManagedCpp::foo();
托管C ++:
extern "C" __declspec(dllexport) void __stdcall foo()
{
CssCode::bar();
}
C#
public static void bar()
{
// From here it initializes some stuff from the registry
// into some data structures which I plan on marshaling
// back with other method calls, which I know involves placing
// things on the stack that can be returned normally to the
// managed c++ code which then will need to be marshed back to the
// unmanaged c++ code.
// All code will be static.
}
我究竟做错了什么? 据我所知,我需要从非托管代码中隐藏我的C#调用,但是我不太确定该怎么做。
空洞的错误。
我将调用从托管c ++放在标头中的c#代码中。 哎呦。 一切似乎都正常了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.