主题:请教:C做Dll出现 Dll调用约定错误
我对C一窍不通,因有急用临时用Dev-C++写了个Dll给VB用,却出错了
__declspec(dllexport) int Test1(int r){
return (r+1);
}
int __declspec(dllexport) Test2(){
return (2);
}
vb中
Declare Function Test1 Lib "dllmain.dll" Alias "_Z5Test1i" (ByVal b As Integer) As Integer
Declare Function Test2 Lib "dllmain.dll" Alias "_Z5Test2v" () As Integer
1.为什么Test2正常返回2而Test1(1)则出现“实时错误49 Dll调用约定错误”?
[em18]
2.请教:怎样用C实现下面的vb语句并让VB调用(比如API)?
Function abc(d() As Byte, e As Integer, f As Byte) as long
d(e) = f
End Function
比如这样调用
Private Sub Form_Load()
Dim a(2) As Byte, b as long
b = abc(a, 1, 2)
b = abc(a, 2, 3)
Caption = str(a(1)) & str(a(2))
End Sub
__declspec(dllexport) int Test1(int r){
return (r+1);
}
int __declspec(dllexport) Test2(){
return (2);
}
vb中
Declare Function Test1 Lib "dllmain.dll" Alias "_Z5Test1i" (ByVal b As Integer) As Integer
Declare Function Test2 Lib "dllmain.dll" Alias "_Z5Test2v" () As Integer
1.为什么Test2正常返回2而Test1(1)则出现“实时错误49 Dll调用约定错误”?
[em18]
2.请教:怎样用C实现下面的vb语句并让VB调用(比如API)?
Function abc(d() As Byte, e As Integer, f As Byte) as long
d(e) = f
End Function
比如这样调用
Private Sub Form_Load()
Dim a(2) As Byte, b as long
b = abc(a, 1, 2)
b = abc(a, 2, 3)
Caption = str(a(1)) & str(a(2))
End Sub