在C ++中使用非常C#DLL [英] Using a Very C# DLL in C++
问题描述
我想使用一个C#DLL,它有多个引用.NET类和Embarcadero C ++ Builder中的C#类。
类似于Point类和String类以及代理。
I am trying to use a C# DLL which has multiple references to .NET classes and C# Classes in Embarcadero C++ Builder. Things like the Point class and String class as well as Delegates.
我想知道如果> .NET引用或C#将会弄脏我。我只是想把它连接起来,但我想知道是否有一些问题,我有可能是由C ++不想玩好。
I am wondering if the >NET references or C# ones will mess me up somehow. I am just about to getting it hooked up, but I am wondering if some of the problems I am having could be caused by C++ not wanting to play nice.
推荐答案
I gave a similar answer to your problem in this question.
你基本上想要一个C ++ / CLI界面来处理你的C#代码。
You basically want a C++/CLI interface to your C# code.
如果你想传递一个C#委托给C ++代码,你可以使用 Marshal :: GetFunctionPointerForDelegate()
( MSDN )。这给了一个 IntPtr
,你可以调用 ToPointer()
on作为函数指针传入。
If you want to pass a C# delegate to C++ code, you can translate it using Marshal::GetFunctionPointerForDelegate()
(MSDN). That gives you a IntPtr
that you can call ToPointer()
on to pass in as a function pointer.
这篇关于在C ++中使用非常C#DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!