Hi,
I've created a C DLL that is being used by a VB EXE. The VB code passes the
addressof a function to the C DLL. The C DLL later on calls the function in
the VB Code; If the function has no parameters it works, however when I
change the function to add a parameter the following debug error is thrown:
"The value of ESP was not properly saved across a function call..."
My code is as follows:
C DLL:
static void (* TestEvent)(bool c);
//setting the callback function
EXPORT BOOL __stdcall SetCallBack(void (* __stdcall TestCallBack)(bool c))
{
TestEvent = TestCallBack;
//testing the callback
TestEvent(true);
}
VB CODE:
'in a form
public sub Form_Load()
SetCallBack(AddressOf TestCB)
end sub
'In a public module
Public Declare Function SetCallBack Lib "Test.dll" (ByVal CallBack As Long)
As Boolean
Public Sub TestCB(ByVal c As Boolean)
Debug.Print "gotcha"
End Sub