如何在c#项目中使用c ++ dll? [英] how to use c++ dll in c# project?

查看:244
本文介绍了如何在c#项目中使用c ++ dll?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

在C#应用程序中使用C ++类DLL





如果您有任何其他方法可以在c#中添加或使用c ++ dll,那么尝试在c#

I try to failed to add reference to add c++ dll in c#

中添加引用添加c ++ dll。我们如何使用?

if you have any other method to add or use c++ dll in c#. how can we use?

我在c#项目中添加dll是什么错误?

Where do i mistake to add dll in my c# project?

提前感谢

推荐答案

对于在C#中使用本机C ++库,您主要需要创建一个 C ++ / CLI 包装器。只要您的DLL的API只包含简单的类C函数,P / Invoke就可以了,但是当API包含实际的C ++类时,C ++ / CLI对于该任务来说更好。

For using native C++ libraries in C#, you mostly will have to create a C++/CLI wrapper for that. P/Invoke is ok as long as the API of your DLL contains just simple C-like functions, but when the API contains real C++ classes, C++/CLI ist much better for that task.

这篇关于如何在c#项目中使用c ++ dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆