C Mania: KDE 3 Offers C Bindings

Richard Dale recently pleasantly surprised me (and probably others) by announcing that he has committed C bindings for the KDE3/Qt3 libraries to KDE's CVS. Richard generated the C bindings automatically using a hacked kdoc, with relatively little manual intervention. According to him, "The bindings wrap about 800 classes [and] 13,000 methods, with 200k [lines of code] of C/C++ generated." The same hacked kdoc can also generate Objective C and Java bindings, and Richard hopes to be able to consolidate generation of these various KDE bindings (Java/Objective C/C) with this one tool. Currently the C bindings for KDE 3 and Qt 3 are in KDE's CVS, with bindings for KDE 2.2.x/Qt 2.3.x awaiting resolution of a dynamic linking/PIC problem which affects the Objective C bindings (please contact Richard if you are knowledgeable in this area).

Dot Categories: 

Comments

by Bernd Gehrmann (not verified)

A component model without ui stuff is pretty uninteresting for
a GUI program.

by Jarvis Cocksucker (not verified)

> A Bonobo/XParts bridge would be cool.

And why would that be? Because you were told from
Gnome.org and incompetent journalists that bonobo
is cool?

Let pretend for a minute that it actually is cool.

Can you name a Gnome application that uses bonobo
and puts it to good use? One that we don't have a
better KDE counterpart for already.

Which? The perpetual beta Evolution? Nautilus?
Something else that escapes me?

Crap, utterly crap. How come then bonobo integration
is your dream wish? Why not ask for better speed/stabi-
lity/resource friendliness/some new app, etc?

Do you really NEED bonobo integration? Because some
lamers posting on slashdot told you it was cool?

Even its creator is not in bonobo anymore. Go read
Miguel De Icaza's site. He now prefers communication
a la manner de .NET.

If I had a cent for everytime one asks for Gnome/Bonobo
integration I would be running Linux on a Sun Blade.

by d-Orb (not verified)

I know that Fortran isn't as sexy as python or Java, but we do have a lot of users here who used F9x (x=0,5) for numerical computations. Usually, a simple GUI is needed to display graphs and control the main program. Because most compilers in Windows can use the Win32 API, the code is written for that particular API. And it would be great if code could be written for KDE (or QT, for that matter) so that it is portable. F9x has a number of features which would make it possible (I think). Other than that, a good job :-)

by Bernd Gehrmann (not verified)

You can write the GUI part in Python or C++, and call Fortran
routines for the numerical stuff.

by d-Orb (not verified)

Yes, but that defeats the purpose of it! People could well write the
GUI in C, but they won't: just because there are easy bindings for
the Win32 API in F9x, people use that! And yes, I do use python as
a glue mechanism (however, I like GTK+ better than QT for my stuff)

Just curious.

If it's done like I did it, it is not handled at all.
If you want to create a new kind of widget, all you have to do is change its event handlers.
So, you should make a new function to draw stuff, and a new function to handle mose events, and keyboard events.

Basically, from a "regular" Qt programmer, you are limited to inheriting from QWidget.

Unless, of course, you do the sane thing, and write the tiny piece of C++ that you need to create the inherited class, and then wrap THAT class using Richard's tool.

But anyway, since C doesn't have any syntax for inheritance, you just have to hack it the hard way.

Oh, well, I suppose that adding extra member functions to a class *is* trivial, since it's just a naming convention ;-)

by Marc (not verified)

I took a look at the code and at the sample. The java binding seems very
clean. It seems to be completely OO.

The JNI functions and their Java counterpart are created automatically.
I looked at the sample ScribbleWindow.java and it looks like
QT code in Java. Cool.

I don't know if QT AWT (or better Swing) exists or not, but I think that it
is a very good start. Such a system make the maintenance of the code a lot
easier. The ""only"" thing that need to be done is the mapping between the
2 APIs.

Marc