[Kde-bindings] Bindings...

Ashley Winters jahqueel at yahoo.com
Fri Feb 21 07:14:27 UTC 2003


--- Richard Dale <Richard_Dale at tipitina.demon.co.uk> wrote:
> He he - 'wtS6' just jumps out of the page at me :) But the only
> advantage I 
> can see of using a checksum is to save on the length of the function
> names. 
> Why not just have something like '<class name>_<method name>_<args
> type 
> signature>'? Wouldn't that make debugging easier - 14000 method names
> with an 
> extra 10 bytes each would add 140k to the Qt/KDE bindings libs.

Somehow, I half remember hearing that ld.so didn't like 400 functions
with the same first 16 characters...

How about URL-encoding methods? Just use '0' instead of %.

QWidget::setMaximumSize(QWidget*,QSize const&)

QWidget03a03asetMaximumSize028QWidget02a02cQSize020const026029

Okay, that's a bit nutty. Easy to decode, though. :)

> > As for handling virtual functions, that's handled pretty simply too
> Well, I'm keeping a close eye on this use of the 'simply' adjective..

Hey, it's easy.

> > First, you need to get the global virtual function table for a
> class:
> >
> > extern "C" void *virtual_get_QWidget();
> >
> > Note: that's not the REAL virtual function table I'm using. Just a
> > parallel one. I'm not going that far off the deep end...
> What are all these new 'virtual hook' methods in KDE - are they
> something that 
> can be used for language bindings callbacks?

Saw that in the cvs digest. Didn't look terribly relevant, but I didn't
find any references elaborating on it in Google.

> I like the smoke idea of communicating callbacks via a stack, because
> it means 
> you only need one type of delegate which is passed a reference to the
> stack. 
> Otherwise you need a bazillion different types of callback/delegate
> for each 
> possible virtual method argument type signature.

Yeah, Perl will always need that. Incredibly handy stuff! However,
Python, Ruby, and C# have enough stack-hacking knowledge to read C
arguments directly for its binding interfaces. It's probably
faster/better/easier to just send the arguments directly into those
languages.

However, Qt's signals/slots use my stack-pushing technique. Very fun
when hacking it.

> Nice - that would be good for implementing Objective-C categories
> that can 
> both add to and override existing behaviour of an existing instance
> without 
> subclassing, or for ruby mixins..

Singleton classes are very promising. I like. Not to mention that
PerlQt's signal/slot interface would allow for singleton object to
catch signals on the fly as well...

> > Yes, I'm crazy. It's fun, though.
> Well as far as I'm concerned, lets have more of that bindings
> madness..

My C binding from -fdump is coming along nicely now that I know where
I'm headed. Pretty simple. Just need to get virtual functions doing
their thing.

Ashley Winters

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/



More information about the Kde-bindings mailing list