如何在MFC和CSharp中使用C ++ dll/库 [英] How to use C++ dll/Library in MFC and CSharp

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

问题描述


我想使用Visual Studio 2008创建C ++库或DLL.
现在我想在VC ++ MFC应用程序和C#项目中使用上面创建的库或DLL.

有人可以指导我如何执行此操作.

问候
Ramveer Singh

Hi
I want to create a C++ library or DLL using Visual Studio 2008.
Now i want to use above created Library or DLL in VC++ MFC application and in C# project.

Can someone guide me how to do this.

Regards
Ramveer Singh

推荐答案


使用C ++库(在C#中)的一种解决方案是使用DllImport:
http://msdn.microsoft.com/en-us/library/aa288468%28v = vs.71%29.aspx [ ^ ]
如何编组C ++类 [为初学者创建和使用MFC DLL [ ^ ]

希望对您有帮助,
干杯.
Hi,
One solution to use C++ libraries(in C#) is to use DllImport:
http://msdn.microsoft.com/en-us/library/aa288468%28v=vs.71%29.aspx[^]
How to Marshal a C++ Class[^]

using in MFC:
Creating and consuming MFC DLLs for Beginners[^]

I hope it helps,
Cheers.


嗨 .NET
平台调用教程 [在MFC C ++ EXE中嵌入DLL吗? [扩展DLL [
Hi .NET
Platform Invoke Tutorial[^]

MFC
1. embed DLL in MFC C++ EXE?[^]
2. Extension DLLs [^]

I hope it''s helps.
Roman


由于要在VC ++和C#中同时使用dll,最好将其作为COM dll.通过这种方式,您可以直接将其包含在MFC中,也可以在C#中将其称为COM Assembly
As you want to utilize the dll both in VC++ and C#, you better make this as COM dll. By this way, you can directly include it in MFC as well as refer in C# as COM Assembly


这篇关于如何在MFC和CSharp中使用C ++ dll/库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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