G
Guest
I use the C++.NET to write a dll and call this dll using VB6.
VC++ Code
#include "stdafx.h
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserve
return TRUE
extern "C" __declspec(dllexport) int SPS_Add ( int i1, int i2
int sum
sum = i1 + i2
return (sum)
VB Code
Sub Mai
Declare Function SPS_Add Lib "SPS.dll" (ByVal i1 As Integer, ByVal i2 As Integer) As Intege
Dim a1 As Integer, a2 As Integer, sum As Intege
Dim temp1 As Strin
a1 =
a2 =
sum = SPS_Add(a1, a2
temp1 = a1 & " + " & a2 & " = " & su
MsgBox temp
End Su
I run the VB and get an error: "Bad DLL Calling Convention.". What is wrong
S.N. Yan
03/30/2004
VC++ Code
#include "stdafx.h
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserve
return TRUE
extern "C" __declspec(dllexport) int SPS_Add ( int i1, int i2
int sum
sum = i1 + i2
return (sum)
VB Code
Sub Mai
Declare Function SPS_Add Lib "SPS.dll" (ByVal i1 As Integer, ByVal i2 As Integer) As Intege
Dim a1 As Integer, a2 As Integer, sum As Intege
Dim temp1 As Strin
a1 =
a2 =
sum = SPS_Add(a1, a2
temp1 = a1 & " + " & a2 & " = " & su
MsgBox temp
End Su
I run the VB and get an error: "Bad DLL Calling Convention.". What is wrong
S.N. Yan
03/30/2004