Virtual Inheritance

Started by
1 comment, last by carew 11 years, 6 months ago
Hi,

I found some old posts from 2010 that virtual inheritance isn't supported in AngelScript, but maybe currently an AngelScript support it? If yes please tell me how bind an virtual inheritance classes? I really need it to bind some 3rd party library (without sources so I can't modify it).
Currently when I do somethink like this:
class foo
{
public:
virtual void callMe() = 0;
};

class derived : public virtual foo
{
public:
virtual void callMe()
{
printf("info!\n");
}
};
...
eng->RegisterObjectMethod("derived", "void callMe()", asMETHOD(derived, callMe), asCALL_THISCALL);



I have following error:
'static_cast' : cannot convert from 'asSFuncPtr *' to 'asDWORD *'[/quote]

How can I solve it? I need a solution which work for both MSVC and GCC compilers.

Cheers,
Advertisement
Virtual methods for classes with virtual inheritance still cannot be registered without the use of wrappers.

You should be able to use the autowrappers, though I haven't tried it myself.

If you don't want to use the autowrappers, you can write the wrapper functions yourself as global functions that takes the object pointer as the first or last parameter. For example:


void derived_callMe(derived *obj)
{
obj->callMe();
}

engine->RegisterObjectMethod("derived", "void callMe()", asFUNCTION(derived_callMe), asCALL_CDECL_OBJLAST);



Just out of curiousity. What 3rd party library is this that uses virtual inheritance?

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Thanks a lot!

This topic is closed to new replies.

Advertisement