The value of ESP was not properly saved across a function call
I've seen lots of posts about this problem but I can't seem to get rid
of this error in my application. I've understood that it is due to
mixing calling conventions, i.e. stdcall and cdecl?
I've written an app in VC6 (that uses MFC) that loads a DLL, which in
turn loads another DLL and runs some functions in that. When my app
terminates (normally) after performing all its tasks, I get the error
message mentioned. (File i386/chkesp.c Line 42). The second DLL seems
to be the problem, I've ineherited that from another programer (who I
can't ask for help).
Both DLL's export functions on the form:
extern "C" __declspec(dllexport) int Init( ..... );
So they should default to cdecl (this is also specified in the project
settings). In none of the projects can I find any mention of stdcall. I
seem to have tracked down the problem to some logging functionality in
the second DLL. When I don't initialize the logging, the error
dissapears. Does this mean _for sure_ that the error is somewhere in
the logging, or could it still be somewhere else?
The logger is declared as:
class MCLogger : public CObject
in the h-file, and then "IMPLEMENT_DYNCREATE(Logger, CObject)" in the
c-file. Can this be relevant to my problem?
The logger also starts a thread using:
theLogThread = AfxBeginThread(mLogThread, (LPVOID)this);
but that is cdecl, so shouldn't be a problem right?
Please, any help is much appreciated. I can run my app without problems
right now (still in development, so not really sure _everything_
works....) and the logger works, but when the app terminates I always
get that error. I can't very well send out the release version like