VB调用C++封装的DLL,无法在VB工程调试.解决方法
VB调用C++封装的DLL,无法在VB工程调试...
用C++封装一个DLL,在VB6.0下来调用。
在C++工程中可以调试DLL
但是在VB工程中调试,就提示"实时错误49,DLL调用约定错误"
但是直接运行VB生成的EXE文件没有错误,感觉问题很奇怪,
对这部分熟悉的朋友帮忙介绍下原因,谢谢!
------解决方案--------------------
怎么解决的
用C++封装一个DLL,在VB6.0下来调用。
在C++工程中可以调试DLL
但是在VB工程中调试,就提示"实时错误49,DLL调用约定错误"
但是直接运行VB生成的EXE文件没有错误,感觉问题很奇怪,
对这部分熟悉的朋友帮忙介绍下原因,谢谢!
- C# code
// C++ Code // 没有使用 def文件和stdcall ///////////////////////////////////////// //测试整数传入和传出 extern "C" __declspec(dllexport) int testSetGetInt(int iIn, int &iOut); //测试整数传入和传出 extern "C" __declspec(dllexport) int testSetGetInt(int iIn, int &iOut) { iOut = iIn + 2; return iOut; }
- VB code
''''''''''''''''''''''''''''''''''''''''''''''''' '''''' test.bas Option Explicit '测试传入传出整数 Declare Function testSetGetInt Lib "test.dll" (ByVal intIn As Long, ByRef intOut As Long) As Long '''''' Form1.frm Option Explicit '测试传入传出整数 Private Sub Command1_Click() Dim aInput As Long Dim bOutput As Long Dim cRetVal As Long aInput = 10 cRetVal = testSetGetInt(aInput, bOutput) Print aInput, bOutput, cRetVal End Sub
------解决方案--------------------
怎么解决的