Passing script objects as base pointers?
In the test framework I have a test for multiple inheritance already (testmultipleinheritance.cpp). It should have covered this scenario, but I'll try recreate your problem to see if there is a difference.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Also, that proxy function is declared virtual, if that makes any difference.
Maybe it has something to do with multiple-inheritance with an implicit cast? idk.
bool addOverlayCalled = false;class Drawable {private: int somestuff;protected: int somethingElse;public: Drawable( ) {} virtual ~Drawable() {} virtual void addOverlay( ) { addOverlayCalled = true; }};class Creep {private: int somestuffOfMine;protected: int duh;public: Creep() {} virtual ~Creep() {}};class CreepClient : public Creep, public Drawable {private:protected:public: CreepClient( ) {} virtual ~CreepClient() {}};void Dummy() {}bool Exec(asIScriptEngine *engine, Creep &c){ bool fail = false; CreepClient &cc = dynamic_cast<CreepClient&>(c); asIScriptModule *mod = engine->GetModule("mod"); int funcId = mod->GetFunctionIdByIndex(0); asIScriptContext *ctx = engine->CreateContext(); ctx->Prepare(funcId); ctx->SetArgObject(0, &cc); int r = ctx->Execute(); if( r != asEXECUTION_FINISHED ) { fail = true; } ctx->Release(); return fail;}bool TestMultipleInheritance2(){ bool fail = false; int r; asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); r = engine->RegisterObjectType("CreepClient", sizeof(CreepClient), asOBJ_REF ); assert( r >= 0 ); r = engine->RegisterObjectBehaviour("CreepClient", asBEHAVE_ADDREF, "void f()", asFUNCTION(Dummy), asCALL_CDECL_OBJFIRST); assert( r >= 0 ); r = engine->RegisterObjectBehaviour("CreepClient", asBEHAVE_RELEASE, "void f()", asFUNCTION(Dummy), asCALL_CDECL_OBJFIRST); assert( r >= 0 ); r = engine->RegisterObjectMethod("CreepClient", "void addOverlay( )", asMETHOD(CreepClient, addOverlay), asCALL_THISCALL); assert( r >= 0 ); const char *script = "void fireEffects( CreepClient@ c ) { \n" " c.addOverlay( ); // This one doesn't ever fire off \n" "} \n"; asIScriptModule *mod = engine->GetModule("mod", asGM_ALWAYS_CREATE); mod->AddScriptSection("script", script); r = mod->Build(); if( r < 0 ) { fail = true; } CreepClient cc; fail = Exec(engine, cc) || fail; if( addOverlayCalled == false ) fail = true; engine->Release(); return fail;}
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
#include <iostream>#include <assert.h>#include "angelscript.h"using namespace std;{ // Your code here}int main() { if( TestMultipleInheritance2() ) cout << "Success!" << endl; else cout << "FAIL" << endl;}
and it fails. I tested it with MinGW on both GCC 4.x and 3.x.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
http://prdownload.berlios.de/codeblocks/codeblocks-8.02mingw-setup.exe
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
I just noticed that you were running the test slightly wrong. The function TestMultipleInheritance2() returns 'true' if it fails, but in your test you interpret 'true' as success. So I guess this means that my test didn't reproduce the problem on your setup either.
However, downloading Code::Blocks with MinGW wasn't fruitless. There were plenty of other bugs that showed up for MinGW/Win32. I've fixed them now, so you may want to download the new version from the SVN. Perhaps some of the bugs I fixed was also the cause for the problem you were having.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game