bad DLL calling convenction.
I have exported two C++ functions into a dll.
int getNumber1(){return 9;};
int getNumber2(int a){return a;};
VB Code:
'Declaration
Public declare function getNumber1() Lib "C:\Link5.dll" () as Long
Public declare function getNumber2() Lib "C:\Link5.dll" (Byval a as Long) as Long
'Usage
Msgbox (getNumber1)
Msgbox (getNumber2(5))
The program displays a msgbox with number 9 as returned by the first function. But the 2nd statement produces an error "Bad DLL calling convention".
What seems to the error here?
Re: bad DLL calling convenction.
Code:
Private Declare Function getNumber1 Lib "C:\Link5.dll" () As Long
Private Declare Function getNumber2 Lib "C:\Link5.dll" (ByVal a As Long) As Long
Code:
extern "C" __declspec( dllexport ) __stdcall int getNumber2(int);
extern "C" __declspec( dllexport ) __stdcall int getNumber2(int a)
{
return a;
};