Functions in the calling DLL sometimes appear as follows:
Microsoft Visual C Debug Library: Debug Error: Program: ... Module: File: i386 / chkesp.cLine:. 42The 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. (Press Retry To Debug The Application)
One of its solutions is:
Add WinAPI before the function call, see the following items.
From http://www.opencascade.org/org/forum/thread_2812/
Help! Calling Convention Error!
fhchina | reply2002-04-27 14:! 43Please Help me I encounter the such `splendid 'error at runtime: Microsoft Visual C Debug Library: Debug Error: Program: ... Module: File: i386 / chkesp.cLine: 42The value Of ESP WAS Not Properly Saved Across A Function Call. This is Usually A Result of Calling A Function Decland WITH CALLING CONVENTION WITH A FUNTER DECLARED WITH A DIFFERENT CALLING CONVENTION.
fhchina | reply2002-04-27 14: 49Sorry, misclick the mouse, the following is the correct message.Please Help me I encounter the such `splendid 'error at runtime: Microsoft Visual C Debug Library: Debug Error: Program: ..! . Module: File: i386 / chkesp.cLine:. 42The 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 (. Press Retry to Debug the Application) Then Press Retry to debug it, each time I found my program abort at the following code: /// aLine is a pointer of AIS_Line.Handle (Geom_Point) hStart, hEnd; aLine-> Points (hStart , hEnd); TopoDS_Edge aEdge = BRepBuilderAPI_MakeEdge (hStart-> Pnt (), hEnd-> Pnt ());.? Each time the call stack will show the program abort on the final line Why I think I should not consider any calling Convention as an application developer. and this segment is running very well before i introduce Ocaf Into my Applicatio n. And i Have Checked All The Compiler Options, IT Seem No Problem. please Help Me! Lugi.c | reply2002-04-28 02: 09maybe You NEED Rebuild All your Files of the Projects.
fhchina | reply2002-04-28 06:. 52Thanks for your response I have solved the problem last night But before report this error I have rebuild all of my files include both Debug & Release version The error still exists, even I turned off.. / GZ option. And I have found some similar posts on the Internet by Google, but there is no statisfactory solution or explanation. As far as my experience for this error, it usually a logic error of code. And I guess this kind of logic error cause this ESP register check error (The concrete reason is still unknown), but it must not be the calling convention mismatch.manoj vithanage | reply2002-11-06 11:. 37thank you very much u saved me from a lot of trouble. Thanx Again
Parthasrarthy | Reply2003-07-05 19: 20great !!, I Also Have The Saved Me ... Thanks LOT.
Jeffrey Magder | reply2003-07-08 21: 53I was having the same problem, but I just FIXED it I was getting the same error from the following code: HMODULE hPowerFunctions = LoadLibrary ( "Powrprof.dll"); typedef bool (*. tSetSuspendStateSig) (BOOL, BOOL, BOOL); tSetSuspendState SetSuspendState = (tSuspendStateSig) GetProcAddress (hPowerfunctions, "SetSuspendState"); result = SetSuspendState (false, false, false); <---- This line was up where the error popped. After some investigation, I changed one of the lines to:. typedef bool (WINAPI * tSetSuspendStateSig) (BOOL, BOOL, BOOL); which solved the problem If you take a look in the header file where SetSuspendState is found (powrprof.h, part of the SDK), you will see the function prototype is defined as: BOOLEAN WINAPI SetSuspendState (BOOLEAN, BOOLEAN, BOOLEAN); So you guys are having a similar problem When you are calling a given function from a .dll, its signature. IS probably off. (in My Case It Was The Missing WinApi Keyword). Hope That Helps Any Future P Eople! :-) chess.dheeraj | reply2003-08-21 23: 25hi, I Was Alos getting the Same Kind of error. I have tried what war u suggested in a function pointer. i Have Added WinApi to a Function Pointer and My Program worked.thanks for the such information which helped me.
Dheeraj | reply2003-08-21 23: 25Hi, I was alos getting the same kind of error I have tried what way u suggested in a function pointer I have added WINAPI to a function pointer and my program worked.Thanks for the such.. Information which helped me.hope to get more information of so nature.cheers
Jagadish Kumar | Reply2003-12-16 02: 17hi, I Was Having the Same Problem. It got fixed with your solution. Thanx a lot. It really saved a lot of time.cheers, jagadishchristian posta | reply2004-11-23 01: 27THANKS a LOT, You Really Saved Me A Lot of Frustration by Adding The WinApi Signature Word !!
Pasi | reply2004-12-16 12: 49this really helped me a lot! Thank you very much! The word i was missing was callback. :)
Dilshan Jesook | reply2005-01-03 15: 47I was having this same problem with that stupid runtime error allways poping up, and solved it by typing in the WINAPI keyword ... problem solved Thanks to such forum..
John | reply2005-03-09 14: 55THAK You Very Much, I had exactly the same error.thanks.
Ben | reply2004-04-16 11: 14I have the same problem when I call a function in an ATL Dll from VB.There is no more error message during runtime when removing / GZ option, however VB generate an exception when I close it. .
K | reply2003-01-21 16: 46i Just Got That Message Last Night- What Did you do to fix it? I'm hoping to not reed to Reformat
KMP | reply2003-03-11 21: 26i'm facing the Same Problem. And as said, ITS Pointing to the end of a func call. In this function, i Have Called a Funtion Pointer That Stores The Address Returned by The Api Call GetProcaddress (). Which is inturn usedfor Thunking from 32 bits to 16 bits. Other Than Removing / GZ, Is there any other
Prashant Deshmukh | reply2003-04-01 08: 40I came across this Debug error message when I was parsing XML using Xerces -> Dom parserIt seems to be logical error SinceThe code worked when I triedTypcasting direct (DOMText *) DOMNode * But fails if I am trying to access a method GetWholeText () by typcasting like (DOMText *) (DOMCharachter) DOMNode * Do any body have solution or reason why this is happening ???? KMP | reply2003-03-11 21: 26I'm facing the same problem. and as said, its pointing to the end of a func call. In this function, I have called a funtion pointer that stores the address returned by the API call GetProcAddress (). which is inturn usedfor thunking from 32 bits to 16 Bits. Other Than Removing / GZ, is There Any Other Way Out.
Karim Sharif | reply2003-12-09 22: 49In my case it turned out to be an invalid memoryinitlization to zero, which wiped out whatever wason stack All these happend in the DLL which wasbeing call from my C program..
Lucia | reply2003-10-28 12: 04HEEN, I have the Same Error. I Found IT WHEN I ADDED A Bitmap in My FlexGrid. This is my code: ... cpictureholder pic; pic.createbitmap (idb_bitmap); m_grid.SetRefCellPicture (pic.GetPictureDispatch); ..... I, ve seen that the problem is the following: when i call Createbitmap or any function of CpictureHolder class, my program jump to an incorrect address in MFCO42D.dll, BUT I DON MS SOW WHY, Anyone Can Help Me ?? Thanks
Stephanie Engrand | Reply2004-03-25 23: 51i ENCOUNTER THE SAME ERROR: IT WAS BECAUSE I forgot to Put: using std :: basic_string; i hope this help you (sorry for my english but I'm french)
K Off In Kadri | Reply2004-11-13 10: 04Email ME