用C#DLL替换C ++ DLL [英] Replace C++ DLL with C# DLL

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

问题描述





我们有一个使用C ++ dll的系统。这个dll有一些带有指针引用的函数。我们不想对主系统进行更改。



如果两者都提供相同的功能,我们可以用C#dll替换C ++ dll吗?



请咨询。



谢谢



Pr。



我尝试了什么:



我有没试过这个。这是要求。

Hi,

We have a system which uses C++ dll. This dll has some functions with pointer references in it. We do not want to make changes to the main system.

Can we just replace C++ dll with a C# dll if both provide the same functionality ?

Please advice.

Thanks

Pr.

What I have tried:

I have not tried this .This is the requirement.

推荐答案

这不容易,但可能。绕伤的另一种方式更容易。您必须将托管方法导出为非托管方法。许多人会告诉你这是不可能的,但CLR和IL标准正式允许这样的事情,而C#编程并不直接支持这些事情。几个CodeProject文章提出了解决方法。详情请见以下答案:

loading MFC中的C#DLL
如何在Visual Basic 6.0中使用在Visual Basic 2008中创建的dll

使用无人码VC ++编写用C#编写的托管DLL

.Net中的API:托管代码或非托管代码



-SA
This is not easy, but possible. The other way around wound be much easier. You have to export managed method as unmanaged. Many will tell you that this is impossible, but the CLR and IL standards formally allow such things, which is not directly supported by C# programming. Several CodeProject articles put forward the work around approach. For further detail, please see these answers:
loading C# DLL in MFC,
How can I use a dll created in Visual Basic 2008 in Visual Basic 6.0,
Call Managed DLL written in C# from Unmanged Code VC++,
API's in .Net: Managed or UnManaged Code.

—SA


这篇关于用C#DLL替换C ++ DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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