Hi again!
I've encountered a weird problem when calling virtual functions on Android (ARM version). It seems like I'm getting a crash whenever I call a inherited function, whether or not it is overwritten by a derived class. For example if I have these two classes:
class Base
{
public:
virtual void printA()
{
LOGI("Base: PrintA called");
}
virtual void printB()
{
LOGI("Base: PrintB called");
}
};
class Derived : public Base
{
public:
void printA()
{
LOGI("Derived: PrintA called");
}
};
And I register printA and printB at some point using the following:
scriptEngine->RegisterGlobalFunction("void printA()", asMETHOD(Base, printA), asCALL_THISCALL_ASGLOBAL, derivedObj);
scriptEngine->RegisterGlobalFunction("void printB()", asMETHOD(Base, printB), asCALL_THISCALL_ASGLOBAL, derivedObj);
If I now call either printA or printB in AngleScript, my Android application will crash.
Now, as a disclaimer, I might have messed up my configuration at some point, however I don't know how to track down the problem if it in fact is a configuration problem. I've made sure __GNUC__ and ANDROID is defined. I figure it might have something with the VIRTUAL_BASE_OFFSET macro, but, then again, my lack of the technical know-how makes it difficult for me to track the exact problem down.
Has anyone else got something like this to work?
As a side note; I have managed to register and call simple global functions and different value type objects (strings and math objects), so the problem seems to be quite specific. Also, I cannot explain this, but in my main application, I'm actually able to call some function which are registered in this way (but mostly not), but I'm not able to find any obvious pattern among them
Anyways, looking forward to some feedback!