> Hi, the $.vtable Pointer is just there to allocate more space for the > CPPStruct, and to properly align the struct attributes. > > C++ itself cares about the vtable, not NativeCall.
Understood. My question is, whether there is one, or two $.vtable Pointers allocated in this case: class QObject is repr<CPPStruct> { has Pointer $.vtable; } class QPushButton is repr<CPPStruct> is QObject { has Pointer $.vtable; } my QPushButton $a; > What would help to fix any issues would be to prove a sample code in the > style of the rakudo/t/04-nativecall/* tests. > (Without depending on qt of course) I'm more than happy to do that, but I thought the presented errors are my misunderstanding of the language than actual problems. Thank you -- Vlad > > Cheers, Tobias > > Am 24.07.2016 um 09:03 schrieb Vladimir Marek: > >Hi, > > > >I'm playing with QT library in perl6. I got it somehow working, but now I > >wonder whether I'm doing it right. > > > >QT objects are C++ classes. Roughly there is base class QObject. From that > >object QWidget isderived. > > > >class QObject; > >class QWidget : public QObject; > >class QAbstractButton : public QWidget; > >class QPushButton : public QAbstractButton; > > > >you get the picture. > > > > > >I have represented these in p6 like: > > > >class QObject is repr<CPPStruct> { > > has Pointer $.vtable; > > ... > >} > > > >class QPushButton is repr<CPPStruct> is QObject { > > has Pointer $.vtable; > > ... > >} > > > >I have skipped for now QWidget and QAbstractButton for now. It works, but: > > > > > >- isn't it a problem that both classes have the $.vtable variable? > >QPushButton > >overriding QObject one? I guess that is ok though, there's always just a > >single pointer. > > > > > > > > > >- I have tried to mimick GTK::Simple tap providers, but failed. > >class QPushButton is repr<CPPStruct> is QObject { > > has Pointer $.vtable; > > has $!clicked_supply; > >} > >===SORRY!=== Error while compiling /home/neuron/qt/qt.pl > >CPPStruct representation only handles int, num, CArray, CPointer, CStruct, > >CPPStruct and CUnion > > > > > > > > > >- I have tried to view QPushButton as a role to QObject > > > >role QPushButton is repr<CPPStruct> is QObject { > > # line 63: > > my sub qt_QPushButton_show(QPushButton) is native('p6', v1) is > > mangled(False) { * }; > > > >===SORRY!=== Error while compiling /home/neuron/qt/qt.pl > >Too many positionals passed; expected 2 arguments but got 3 > >at /home/neuron/qt/qt.pl:63 > > > >The same for > > > >role QPushButton is QObject { > > > > > > > >- I have tried > > > >class QPushButton does QObject { > >===SORRY!=== Error while compiling /home/neuron/qt/qt.pl > >QObject is not composable, so QPushButton cannot compose it > > > > > > > >I have not tried making QObject a unit, is it the way to go? I'm trying to > >chew > >on the line from GTK::Simple. I'm not sure yet what it is and how relevant it > >is. > > > >unit class GTK::Simple::Button does GTK::Simple::Widget; > > > > > >Thank you > >__ > > Vlad > > >