# 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.

## 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 on other sites

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 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

1. 1
2. 2
3. 3
Rutin
19
4. 4
5. 5
JoeJ
12

• 14
• 22
• 9
• 31
• 17
• ### Forum Statistics

• Total Topics
632617
• Total Posts
3007470
• ### Who's Online (See full list)

There are no registered users currently online

×