I'm having trouble figuring out exactly how to reference managed c++ code that calls c# code from unmanaged c++ code. Let me throw out a few scenarios:
Compiler error is C2653.
Here's what I'm doing:
Unmanaged c++ code: I've set the linker to include my managed c++ lib file.
#include "ManagedCpp.h"
ManagedCpp::foo();
Managed 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.
}
What am I doing wrong? As far as I can tell I need to hide my c# calls from the unmanaged code but I'm not quite sure how to do that.
答案 0 :(得分:0)
空头的错误。
我将来自托管c ++的调用放入标头中的c#代码。哎呦。现在一切似乎都很好!