Click to See Complete Forum and Search --> : Function pointer call stack validation


ander goni
May 5th, 1999, 11:13 AM
Hi everybody:

I call 'LoadLibrary' and 'GetProcAddress' to call certain dll-library functions. I have upgraded to VC++ 6.0, and i am getting this message from file i386\chkesp.c (line 42): "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"

I have used this calling convention to export my function:

#ifdef __cplusplus
extern "C" {
#endif
__declspec( dllexport ) void DBSqlExecInit (int *error);
#ifdef __cplusplus
}
#endif



And my funtion pointer declaration is:

typedef void (* LPFNInit) (int *);



And finally my client access the library like this:

HINSTANCE m_HandleODBCLib = (HINSTANCE)0;
LPFNInit m_pfSqlExecInit;


m_HandleODBCLib = LoadLibrary (ubicacion);

if ( m_HandleODBCLib < (HINSTANCE)HINSTANCE_ERROR )
return;
if ( !(m_pfSqlExecInit = (LPFNInit) GetProcAddress ((HMODULE)m_HandleODBCLib, _T("DBSqlExecInit"))) )
return;
(*m_pfSqlExecInit) (&m_ErrorDB);



I had no problems with VC++ 5.0. Do you know what is happening? any Ideas? Thank's in advance.