GLib/GObject+C as the lingua franca? (was: kwallet and QCA)

Kevin Krammer kevin.krammer at gmx.at
Fri Jul 25 17:47:38 BST 2008


On Friday 25 July 2008, nf2 wrote:
> Robert Knight wrote:
> >> For historic reasons KIO and
> >> KWallet landed in this "KDE desktop environment"
> >
> > Those 'historic reasons' presumably include the licensing issue that Qt
> > is GPL - which, as I understand it, would not be acceptable for gnome. 
> > If Nokia were prepared to re-license the non-GUI components of Qt (eg.
> > QtCore, QtNetwork) more permissively that might change.
>
> Even then i don't know if QtCore based libraries would work in-process
> outside Qt based applications. I guess you need to instantiate
> QCoreApplication for the event loop etc...

Probably the same requirements for the other way around, i.e. Qt being built 
with GLib mainloop support and a QEventLoop object.

> Yeah - i am currently playing with Qt/C++ bindings for the GIO API to
> investigate this. It's a bit tricky, particularly with interfaces,
> multiple inheritance... For instance this case:
>
>    WrappedObject (carries the GObject)
>
> InputSteam    Seekable(Interface)
>     \                  /
>     FileInputStream
>
> I tried to solve this by deriving from WrappedObject with the virtual
> keyword, but i don't know whether this is good or evil. ;-)

Not sure if you actually have to do all this, e.g. streams, having a GIO data 
source/sink as a QIODevice will most likely be enough.

> Another problem is copy-constructors/operators. Passing around wrapped
> GObjects that way works quite nicely, cause you don't need to care about
> garbage collection, but Qt Signal connections are lost when copying the
> object.

Assuming you mean connections of some internal object (since QObjects 
themselves can't be copied anyway), why not just have this shared object in a 
shared (reference counted) private?

> I wonder if a kind of mixed style would work: libraries with public
> GObject/C APIs, but internally stdc++. Staying with GObject/C for the

I think TagLib and libpoppler are examples of C++ based libraries which are 
used in GLib based applications, so they could probably serve as an example 
how the GLib Wrapper is done for programmers using C.

Cheers,
Kevin

-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080725/fc53c00b/attachment.sig>


More information about the kde-core-devel mailing list