Skip to main content
gamedev.net
🔒 Locked

ESP error ... HELP!!!!!!!!!!!!!!!!!!

Started by dragon376 Jan 13, 2002 at 7:11 PM 2 replies 450+ views
Original Post
dragon376
dragon376
The program is a OpenGL 3D game, that is many function call per window loop. The error only occurs when compiled in debug version which make me think of a compiler setting problem. The program either crashes telling me that the variable "done" in the main window loop doesn''t exist or there is the following error message: " Debug Error! Program: ... path ...\Program.exe Module: 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 tried both calling convention "_cdecl" and "_stdcall" both fails.
dragon376
dragon376
MORE INFO
After some testing, I could pin point the problem.
in VC++, Project Setting, C/C++ tab, Debug: scroll down menu
If I change from "Program Database for Edit and Continue" to "none", the program doesn''t crash anymore.

Now I would like to understand this error better. I suppose that this option let me modify the program and recompile on the fly. But what does it do behind the scene.

THANKS.
Shannon Barber
Shannon Barber
You turned off the debug code - you didn''t fix the problem!

If ESP gets whacked like that if usually mean you called a function using the wrong calling convetion. Like you called a __stdcall function as though it were a __cdecl, etc...

Do you dynamically load any dlls or use function or method pointers anywhere? Perhaps even a Win32 or OGL callback function is not properly defined/declared.
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
dragon376
dragon376
Actually, I found that if I choose the "Program Database" without "for Edit and Continue", it works. So for some reason, the information added to "edit and continue" screws up my code. BUT, the only place where I precise the calling convention is in the settings, I don''t put the calling convention in front of each function. It seems that some function such as "new" are using _cdecl though I want to use everywhere _stdcall because it is recommended by Microsoft in MSDN. (Win2000 and XP can have problems with _cdecl according to Microsoft)

I don''t load any dlls, but I have pointers all over the place.
I also have one Win32 callback function.

What would be a proper way to define/declare a callback function?
Where and how can you tell your compiler the calling convention?

Thanks

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.