简体   繁体   English

从C#使用C ++ dll

[英]Use C++ dll from C#

I have a C# GUI, and a dll I compiled in matlab for C++. 我有一个C#GUI和一个在Matlab中为C ++编译的dll。 I would like to call from my C# code to the dll functions. 我想从我的C#代码中调用dll函数。 I tried first to convert the C# code to CLI, but then saw it is not recommended. 我首先尝试将C#代码转换为CLI,但随后发现不建议这样做。 Can I create one solution with 2 projects - one the C# GUI and one - wrap the c++ dll with C++ code and call it from the C# ? 我是否可以创建一个包含2个项目的解决方案-一个C#GUI和一个-用C ++代码包装c ++ dll并从C#调用它?

Any reference will be appreciated. 任何参考将不胜感激。

Thanks 谢谢

您可以通过使用[DllImport]属性在C#中使用C ++ dll,此MSDN线程中对此进行了描述。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM