C#-导入C ++类的DllImport. [英] C# - DllImport for importing C++ class.

查看:233
本文介绍了C#-导入C ++类的DllImport.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我在DLL中有一个课.

我可以在C#中使用此类吗?
我检查了DllImport,发现它可用于访问非托管功能,是否可以建议它是否可用于访问C ++ dll中的类.
如果是这样,请提出建议!


谢谢,
Arun P.

解决方案

这是可能的.据我了解,您有两种选择.
1.您使用C ++/CLI包装器访问非托管代码
2.您可以按以下说明使用COM互操作功能:
在.NET应用程序中使用非托管C ++库(DLL) [ ^ ]
您还应该阅读以下内容:
http://msdn.microsoft.com/en-us/library/ms973872.aspx [ ^ ]

在C#中使用非托管代码和汇编器 [ ^ ]

Hello Everyone,
I have a class inside a Dll.

Is there any way i can use this class in C#?
I checked for DllImport, i see it can be used to access unmanaged-function, can any one suggest, whether this can be used to access a class inside a C++ dll.
If so, please suggest!


Thanks,
Arun P.

解决方案

This is possible. As far as I know you have two options.
1. You use a C++/CLI wrapper to access the unmanaged Code
2. You use COM interop functionality as described here:
Using Unmanaged C++ Libraries (DLLs) in .NET Applications[^]
You should also read through this:
http://msdn.microsoft.com/en-us/library/ms973872.aspx[^]
and that
Using Unmanaged code and assembler in C#[^]


这篇关于C#-导入C ++类的DllImport.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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