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 convention.
Could it be the string that is causing the error? I have included the scriptstring from the sample, and called RegisterScriptString().
If you need to know any more please just tell me.
Function call run-time error
I have two functions:
GUIElement *GetActiveElement();
GUIElement *FindElement(string);
Both are registered with AngelScript. GetActiveElement() works, but FindElement does not. Windows gives me this error:
Does FindElement() expect a std::string by value? This would explain why ESP is wrong, since the library is pushing a asCScriptString on the stack, but FindElement() only removes a std::string.
Actually you cannot pass ScriptString to a function by value since it will not correctly handle the reference counting if that is so (the destructor is even protected to prevent C++ from instantiating the class locally). In fact, I may have to change the library to check for this case, as it is a configuration error.
Instead you ought to pass the string by reference, and register FindElement() with the following declaration "GUIElement@ FindElement(string &in)".
If this isn't the error, then you might want to verify the calling convention you specified when registering the function: asCALL_CDECL or asCALL_STDCALL.
Regards,
Andreas
Actually you cannot pass ScriptString to a function by value since it will not correctly handle the reference counting if that is so (the destructor is even protected to prevent C++ from instantiating the class locally). In fact, I may have to change the library to check for this case, as it is a configuration error.
Instead you ought to pass the string by reference, and register FindElement() with the following declaration "GUIElement@ FindElement(string &in)".
If this isn't the error, then you might want to verify the calling convention you specified when registering the function: asCALL_CDECL or asCALL_STDCALL.
Regards,
Andreas
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement