Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

Virtual Inheritance


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 carew   Members   -  Reputation: 133

Like
0Likes
Like

Posted 15 October 2012 - 08:21 PM

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 *'


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

Cheers,

Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3293

Like
1Likes
Like

Posted 16 October 2012 - 07:32 AM

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

#3 carew   Members   -  Reputation: 133

Like
0Likes
Like

Posted 17 October 2012 - 09:25 AM

Thanks a lot!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS