🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
crash on executing the print function from the tutorial
Hey guys
ive tried to register a print( string ∈ ) method which was declared in a class..
i did it this way:
r = this->engine->RegisterGlobalFunction("void Print(string ∈)", asMETHOD(TScriptManager,PrintString), asCALL_STDCALL);
1st of all, i have no idea wheater to use the asCALL_STDCALL or the asCALL_THISCALL macro but asCALL_STDCALL seems to work ..
if i call the main function in this script:
<void main() { }>
it works w/o any problems, but if i call it this script
<void main() { print("Hello"); }>
the program crashes and visual studio opens the file "as_scriptengine.cpp"
showing these lines:
#ifndef AS_NO_CLASS_METHODS
if( i->callConv == ICC_THISCALL )
{
union
{
asSIMPLEMETHOD_t mthd;
asFUNCTION_t func;
} p;
p.func = (void (*)())(i->func);
void (asCSimpleDummy::*f)(void *) = (void (asCSimpleDummy::*)(void *))(p.mthd);
(((asCSimpleDummy*)obj)->*f)(param);
}
else
#endif
if( i->callConv == ICC_CDECL_OBJLAST )
so where could the error be?
A class method is always a asCALL_THISCALL, unless it is a static method. The crash is very likely due to this mistake.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement