我可以在Visual Basic中使用C ++函数吗? [英] Can I use C++ functions in Visual Basic?
问题描述
我是一个新的编程,但我已经做了一个很好的库用于计算数学问题,如二次方程和许多其他。
现在我遇到了一个朋友,他在VB中编程了一些,我们正在考虑是否可以将我的函数从C ++导入他的代码,所以他们可以在需要时调用它们,所以我们可以做一个计算器?
我们如何做?
I'm kinda new to programming, but I have made quite a good library for calculating Math problems like Quadratic Equations and many other. Now I met a friend, and hes programming a little in VB, and we were thinking if it is possible to import my functions from C++ to his code, so he can call them, when they are needed, so we can make a calculator? How can we do that?
- Janman
编辑:我的朋友正在使用VB.net
编辑:我的库以自由的函数组织。
My friend is using VB.net My library is organized in free functions.
推荐答案
要使用VB中的C ++代码,您有以下可能性:
to use C++ code from VB you have the following possibilities:
-
并从VB调用它们
Create DLL where you export functions; and invoke them from VB like this
Declare Sub test Lib "c:\somepath\test.dll" (ByVal a As String, ByVal b As String, c As Long)
MFC或任何其他库,并在VB项目中引用dll,这个解决方案是最好的你可以使用C ++ Com组件作为VB代码中的类。
Create Com component with ATL or MFC or any other library , and reference the dll in VB project, and this solution is the best you can use C++ Com components as classes in your VB code.
这篇关于我可以在Visual Basic中使用C ++函数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!