VB调用Dll时约定错误
用vb调用用VC++写的一个Dll文件时,出现实时错误‘49’:DLL调用约定错误
Drive.h定义如下:
............
// public method
ND80DRIVER_API int ConnectSerial ( int comport , int bandrate ) ;
ND80DRIVER_API void Disconnect () ;
ND80DRIVER_API BOOL IsOpened () ;
............
// public method
ND80DRIVER_API int ConnectSerial ( int comport , int bandrate ) ;
ND80DRIVER_API void Disconnect () ;
ND80DRIVER_API BOOL IsOpened () ;
............
VB定义调用如下:
Private Declare Function ConnectSerial Lib "ND80Driver.dll" (ByVal comport As Integer, ByVal bandrate As Integer) As Integer
Private Declare Sub Disconnect Lib "ND80Driver.dll" ()
Private Declare Function IsOpened Lib "ND80Driver.dll" () As Boolean
Private Sub Command1_Click()
Dim i As Integer
i = ConnectSerial(1, 19200)
Disconnect
If IsOpened = True Then
MsgBox "真"
Else
MsgBox "假"
End If
End Sub
为什么在红色字体处出现:DLL调用约定错误。