Jump to content
  • Advertisement
Sign in to follow this  
PhilCK

Runtime error VS 2013

This topic is 1441 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

Now this might not be an AS fault, but I'm running out of options.

I've neglected the Windows side of the engine for a few months, and I am trying to update it. Part of that update was switching from compiling AS from source inside the project to linking to the library (built from projects that AS supplies).

However when the game runs I get the following error.

Run-Time Check Failure #2 - Stack around the variable 'retQW' was corrupted.

This happens in as_callfun_x86.cpp line 1189 (CallThisCallFunction). Any ideas? I'm sure this is me being stupid, but after a day of trying to figure this I'm at a loss.

 

Like I said this might not be down to AS, MSVS isn't my usual environment so I could done something dumb.

Edit

I should mention that I've compiled it with /MD

 

Edit - Some Background

I define my game components in AS, this app has many components however the crash always with the same component which is not the first component to be initialized. They all run through a common script interface. The crash occus when AS calls one of the hook methods (It doesn't matter which if I comment out the line it will crash on a different hook but same component). This is odd, the component in question appears in almost every game object, this isn't the first GO to be created, another is created before and runs through most of the component hooks before this one is even created. This also all works fine on MacOS.

Edited by PhilCK

Share this post


Link to post
Share on other sites
Advertisement

This sounds like you have registered one of your types or methods incorrectly, so that AngelScript tries to call the method in a different way than the C++ calling convention dictates.

 

Windows and MacOS uses completely different ABIs, so the error in the registration can sometimes go unnoticed on one platform but cause this kind of problems on another.

 

Most likely the problem is with the RegisterObjectType() method and the asOBJ_APP_xxx flags. But it can also be with the RegisterObjectMethod() method, e.g. if you've registered it with a different signature than it really has in C++.

 

Try to determine what method is being called when the crash occured and then double check the registration for that method and all the application registered types involved to make sure it is all OK.

 

If you need help, please show me how you've registered the types and also their declaration and I may be able to identify the error.

Share this post


Link to post
Share on other sites

Ah there we go - I have a C++ method addComponent(string, params); however params has a default value an isn't used on scripting side. So I exposed it "addComponent(const string &in)" only. Sent it to a glue function now and it works fine.

Was

engine->RegisterObjectMethod("Entity", "bool addComponent(const string &in)",       asMETHODPR(CaffEnt::Entity, addComponent, (const std::string&, const CaffUtil::Param&), bool), asCALL_THISCALL);

Now

engine->RegisterObjectMethod("Entity", "bool addComponent(const string &in)", asFUNCTION(AddComponent), asCALL_CDECL_OBJLAST);

Thanks.

Edited by PhilCK

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!