Jump to content
  • Advertisement
Sign in to follow this  
personwholives

Calling convention clash....help

This topic is 5476 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I generally don't set my calling conventions, i let the compiler handle that, since it usually does a pretty good job. But i had a problem today, and, uh, it's really wierd. Heres the error message: Debug Error! Program: F:\theEngine\d3dtest\Debug\d3dtest.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. it is caused by this seemingly harmless line of code: if((cube = graph->CreateStaticVB()) == NULL) I have never seen an error like this before, and have no idea how to go about fixing it. Some details that may, or may not help diagnose the problem: graph is a pointer to an interface class, so the pointer actually points to a derived class. the object pointed to by graph was created in a dll, and returned to my program. when i did this previously, i never had this problem. neither the interface nor the implementing class has calling conventions declared on any of the functions. I hope someone knows what to do here, i'm stumped. Thanks personwholives

Share this post


Link to post
Share on other sites
Advertisement
Well, the question is what you changed between when it worked, and when it didn't work. So, what did you change? [smile]

Share this post


Link to post
Share on other sites
I've seen this before, it's nothing to do with calling conventions. Bad Things (tm) are happening with memory - bad pointer, overflows, some other error.

Make sure graph is a valid pointer, if not it could end up some weird location, which could cause this error.

Share this post


Link to post
Share on other sites
Last time I saw that ESP not properly saved bit was in a fairly recent thread - basicly, it occured because the function in question took over 64kb of parameters (he was passing a game map by value, for 90KB in his instance <_<) - the bug was specific to debug mode with some compile flag, which I assume was not set by him.

I also assume similar could result if you're returning by value a class that's over 64KB in size (since CreateStaticVB obviously takes no parameters). This means static, C-style arrays. You're not using any of them are you?

Share this post


Link to post
Share on other sites
i removed a few functions from the interface and combined two classes into this one. neither of these should have affected this. graph is a valid pointer, the code in the program did not change, just whats in the dll. Also, the return value is a pointer to a class, not an array or anything like that. Thats all the info i have.

personwholives

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!