• Advertisement
Sign in to follow this  

Virtual Inheritance

This topic is 1921 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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:
[CODE]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);
[/CODE]


I have following error:
[quote]'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,

Share this post


Link to post
Share on other sites
Advertisement
Virtual methods for classes with virtual inheritance still cannot be registered without the use of wrappers.

You should be able to use the [url="http://www.angelcode.com/angelscript/sdk/docs/manual/doc_addon_autowrap.html"]autowrappers[/url], 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:

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

engine->RegisterObjectMethod("derived", "void callMe()", asFUNCTION(derived_callMe), asCALL_CDECL_OBJLAST);
[/code]


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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement