如何在Borland C ++中使用.NET? [英] How to use .NET in Borland C++?

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

问题描述





我想在Borland C ++中使用基于.NET技术的第三方SDK。在Borland C ++中使用.NET的最佳方法是什么?



关于

Hi,

There is a 3rd party SDK based on .NET technology which I want to use in Borland C++. What's the best way to use .NET in Borland C++?

Regards

推荐答案

这不是这样的简单。首先,我会考虑使用迁移到.NET或使用其他东西。但问题是可以解决的。

请查看我过去的答案:

在MFC中加载C#DLL [ ^ ],

如何在Visual Basic 6.0中使用在Visual Basic 2008中创建的dll [< a href =http://www.codeproject.com/Answers/218977/How-can-I-use-a-dll-created-in-Visual-Basic-2008-i#answer3target =_ blanktitle =新窗口> ^ ],

从无人码VC ++中调用C#编写的托管DLL [ ^ ],

.Net中的API:托管代码或非托管代码 [ ^ ]。



-SA
This is not so easy. First of all, I would think about using migrating to .NET or using something else. However, the problem is solvable.
Please see my past 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


我认为Borland C ++是一个非常陈旧且过时的编译器(我认为),MingW和Cygwin很容易击败Borland,你可以在Wikipedia页面上看到Borland的最后一个稳定版本是在1999年

现在回答你的问题:

你试图将极其不同的东西联系在一起,这实际上是可能的,但是如SA所说的那样非常艰难。

谷歌在c ++中使用c#dll命中

(注意那些人可能会使用其他C ++ / C编译器)

给了我这个:

http://www.cplusplus.com/forum/windows/77244/ [ ^ ]

这里有一些来自这个帖子的信息 http://stackoverflow.com/questions/3799907 / using-c-sharp-dll-in-project-c [ ^ ]

To what I think Borland C++ is a very old and outdated compiler (what I think), MingW and Cygwin easily beat Borland, as you can see on the Wikipedia Page Borland's last stable release was in 1999
Now to your question :
You are trying to Link to extremely different things together, which in fact is possible, but will be extremely tough as SA said.
A google hit on
using c# dll in c++ (Note that those people might use Other C++/C Compilers)
gave me this :
http://www.cplusplus.com/forum/windows/77244/[^]
And here's some info from this thread http://stackoverflow.com/questions/3799907/using-c-sharp-dll-in-project-c[^]
2.2 How do I call .NET assembly from native Visual C++?

There are basically four methods to call .NET assembly from native VC++ code. Microsoft All-In-One Code Framework has working examples that demonstrate the methods.

Native VC++ module calls CLR Hosting APIs to host CLR, load and call the .NET assembly. (All-In-One Code Framework Sample Code: CppHostCLR)

If the .NET assembly can be exposed as a COM component, native VC++ module can call into the .NET assembly through .NET – COM interop. (All-In-One Code Framework Sample Code: CppCOMClient)

Reverse PInvoke: the managed code call native passing a delegate the native code can call back. (All-In-One Code Framework Sample Code: CSPInvokeDll)

If the module containing native VC++ code is allowed to enable CLR, the native VC++ code can call .NET assembly directly through the "It Just Works", or "IJW", mechanism. (All-In-One Code Framework Sample Code: CppCLIWrapLib)



您也可以使用SWIG(简化包装和接口生成器)

http://www.swig.org/ [ ^ ]


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

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