Visual Basic和C ++ [英] visual basic and C++

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

问题描述

我们如何在同一对象中运行可视化基本代码和C ++代码?

How can we run visual basic code and C++ code in the same object?

推荐答案

通过将vb(或C ++代码)编译为单独的DLL,并使用主项目中的DLL(用其他语言编写).
By compiling the vb (or C++ code) into a separate DLL, and using that DLL from the main project (that''s written in the other language).


如果您的意思是经典的VB,COM将是您最好的方法. VB 6和VC ++都是出色的COM开发语言.

如果您的意思是VB.NET,则比较棘手,但可能.您可以使用C ++/CLI互操作(我认为这将是最简单的).还有其他一些不建议使用的机制,例如进行COM互操作(如果要访问托管类型的COM包装器,使用VC ++可能会很麻烦).人们还可以直接修改IL和导出方法(有些像SA的CPian建议这样做),但是我个人建议您远离该路线.
If you mean classic VB, COM would be your best approach. VB 6 and VC++ are both excellent COM dev languages.

If you mean VB.NET, it''s trickier but possible. You can use C++/CLI interop (which would be the easiest in my opinion). There are other less recommended mechanisms like doing COM interop (can be a pain with VC++ if you are trying to access a managed type''s COM wrapper). There''s also a way where people directly modify the IL and export methods (some CPians like SA recommend this), but I would personally recommend that you stay away from that route.


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

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