On Sun, Jul 26, 2009 at 10:31 AM, Andre<ar...@kingston.net> wrote:
> Andre <ar...@...> writes:
>
>
>> I made the following changes to controls.wx.lua
>> ....
>
> this is probably much more then needed
>
> a change is needed because wxLuaBindClass as multiple base classes. I guess
> you have to support multiple inheritance somemwhere.

I noticed this, but I have to make some more changes for multiple
inheritance to work, my quick fix implementation in the current CVS is
broken. I have discovered that given

class A { ... }
class B { ... }
class AB, public A, public B { ... }

AB ab;
void *p_ab = &ab;
((B*)p_ab)->SomeFuncFromB();

corrupts the C++ stack because the pointers to AB are different for A
and B casts or so I'm told. I can't find a useful description about
this online or in any of the books I have.

http://groups.google.com/group/wx-users/browse_thread/thread/8d3ca8031668e778/951af80997466215#951af80997466215

What this means is that my "clever" way of simply casting the void*
pointer that we get from Lua to the base classes to call the desired
function can't work for anything but the first base class. So... I
have been trying to play with template functions with no luck. I think
I will have to make the binding generator simply write out the whole
set of functions for the second and higher base classes for each
class. I would rather not have to have these nearly duplicate
functions, except for the casting of the void* pointer to the correct
C++ datatype, but any other scenarios I can imagine would generate
more and messier code.

Regards,
    John

------------------------------------------------------------------------------
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to