Advertisement

Runtime error VS 2013

Started by October 12, 2014 10:47 AM
1 comment, last by PhilCK 10 years, 1 month ago

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.

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.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

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.

This topic is closed to new replies.

Advertisement