Wierd debug error concerning ESP not properly saved across functins call

Well here is the error,

Debug Error !
Program : MVT.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 have isolated the line of code that when commented out I do not get this error but all it is an assignement of a global variable (global menu_id = 3; ) I know, I know, I wouldnt be using global but I didnt write the code I am only converting the code to GLUT/OpenGL.

The error statement says it has to do with function pointers though… I am not using functions pointers at all except the glut callback function definitions… The error does occurs in the Keyboard event callback when I hit the enter key. Here is the switch portion for the enter key.
case cp_RETKEY:
potato(0);
if(0)
{
strcpy(Mfile,"?");
}
else
{
display();
menu_id = 2;
menu();
menu_id = 3; //if i comment this out the error disappears. Notice that the same var is used above still.
}
menu();
break;

Well just wondering if anyone else has ever had a similar problem.

[This message has been edited by delic (edited 10-14-2002).]

[This message has been edited by delic (edited 10-14-2002).]

[This message has been edited by delic (edited 10-14-2002).]

The error says exactly what the problem is: you corrupted your ESP register. Step through your function with disassembly turned on if reading the code isn’t good enough.

In general, your development tools are much better documented at MSDN online than they are in the OpenGL forums:
http://msdn.microsoft.com/

Yeah I didnt expect any compiler specific help but I think it might have to do with the glut keyboard callback, that’s why I posted here…

still thanks for the advice…

for anyone iterested I fiugred it out… I had to include the functions that were fed to the glutcallbacks within an extern “C”.

[This message has been edited by delic (edited 10-15-2002).]