john tindell
Jan 5th, 2003, 01:30 PM
ive created a DLL and im trying to call it but it keeps giving me these errors.
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
heres my code
#include <windows.h>
typedef void (*MSGBOX)(char*,int);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
HINSTANCE hDLL;
MSGBOX msgProc;
hDLL = LoadLibrary("dlltest.dll");
if(hDLL!=NULL)
{
msgProc = (MSGBOX)GetProcAddress(hDLL,"msgbox");
if(msgProc!=NULL)
(*msgProc)("Batman its worked!", MB_OK);
FreeLibrary(hDLL);
}
return 0;
}
cheers :)
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
heres my code
#include <windows.h>
typedef void (*MSGBOX)(char*,int);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
HINSTANCE hDLL;
MSGBOX msgProc;
hDLL = LoadLibrary("dlltest.dll");
if(hDLL!=NULL)
{
msgProc = (MSGBOX)GetProcAddress(hDLL,"msgbox");
if(msgProc!=NULL)
(*msgProc)("Batman its worked!", MB_OK);
FreeLibrary(hDLL);
}
return 0;
}
cheers :)