在C ++中使用非常C#的DLL [英] Using a Very C# DLL in C++
问题描述
像Point类和String类以及Delegates一样的东西。
我想知道如果.NET引用或C#将会让我失望。我只是想让它挂起来,但我想知道我是否有一些问题可能是由C ++引起的,不希望玩得很好。
你基本上想要一个C#/ CLI界面到你的C#代码。
如果你想传递一个C#委托给C ++代码,您可以使用 Marshal :: GetFunctionPointerForDelegate()
( MSDN )。这给你一个 IntPtr
,您可以调用 ToPointer()
作为函数指针传入。
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.
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.
You basically want a C++/CLI interface to your C# code.
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屋!