Advertisement

Multiple inheretence method problems

Started by May 27, 2009 03:11 PM
1 comment, last by Wavesonics 15 years, 6 months ago
I think I may have brought this up a long time ago, but I finally have a reproducible case in my code. I can try and create a minimal case for it later, but here is the general idea: When I call a inherited method from a parent class in a multiple inheritance hierarchy, I get undefended behavior (either a crash or non-sense return values):

class GameObject;

class Creep : public GameObject;

class Drawable {
    int someFunc();
}

class CreepClient : public Creep, public Drawable;

// ==========================================================================
// Then I register CreepClient with AS, and some of the methods of Drawable:
// ==========================================================================
    r = engine->RegisterObjectMethod("CreepClient", "int someFunc()", asMETHOD(CreepClient, someFunc), asCALL_THISCALL); assert( r >= 0 );


Then in my script I have something like:

void scriptFunc( CreepClient@ c ) {
    int i = c.someFunc();
    print( i ); // This prints non-sense
}


But really it's any method called from the Drawable base class. I found how ever, that if I use the "asMETHODPR" macro instead, it all works :)
==============================
A Developers Blog | Dark Rock Studios - My Site
This is with GCC 4.x, right?

I have to install GCC again and give this a try so I can investigate it.

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
Yes sorry, MinGW/GCC 4.1.2 - Win32
==============================
A Developers Blog | Dark Rock Studios - My Site

This topic is closed to new replies.

Advertisement