如何使用C#和.NET中的C ++库? [英] How do I use a C++ library from C# and .NET?
问题描述
我相信你可以通过引用该DLL并使用C#来调用C#中的一个 externC
dllimport的。但是可以实例化一个模板化的C ++类型吗?如果C ++类型在C#中不支持某些疯狂的怎么办?是否有RFC或相关部分的 C#规范?
感谢...
编辑:我现在偶然发现 P / Invoke ,这应该是有价值的,但我仍然在寻找关于这个的规范或标准。
完美的方法是使用托管c ++访问非托管的C ++并编译到程序集中。
My question is closely related to how a DLL exports C++ classes and generic methods (wrt C++ language features without a C# parallel).
I believe you can call functions inside an extern "C"
block from C# by just referencing the DLL and using DLLImport. But can you instantiate a templated C++ type? What if the C++ type does somethin' crazy that's not supported in C#? Is there an RFC or relevant part of the C# specification?
Thanks...
EDIT: I now stumbled across P/Invoke which should be valuable, but I'm still looking for a specification or standard regarding this.
The sane way to do it is to use managed c++ to access unmanaged c++ and compile into an assembly.
这篇关于如何使用C#和.NET中的C ++库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!