自动转行C ++ DLL到C# [英] Auto wrap c++ dll into c#
问题描述
我要使用C ++库在C#项目。是否有任何的包装工具自动导入所有类?
I want to use c++ library in a c# project. Is there any wrapper tool to import all classes automatically?
推荐答案
的痛饮可以帮助创建由两部分组成的包装,一架C ++片面的,和一个C#片面的。
它需要一些工作来设置正确的新一代文件虽然。
SWIG can help create a wrapper consisting of two parts, one C++ sided, and one C# sided.
It needs a bit of work to set up the correct generation files though.
这需要更多的手工编码的替代方法是C ++ / CLI。
An alternative that requires more manual coding is C++/CLI.
有关纯C API的,我更喜欢的p / Invoke他们通过任。有一个程序来自动的C头文件的转换。如果我没有记错,它被称为像P / Invoke的互操作助手或互操作签名工具包
For pure c apis I prefer p/invoke over either of them. There is a program to automate conversion of c headers. If I recall correctly it's called something like "P/Invoke Interop Assistant" or "Interop Signature Toolkit".
还有的单/ cxxi 看起来很酷。
这篇关于自动转行C ++ DLL到C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!