Header namespacing

Kevin Krammer kevin.krammer at gmx.at
Thu Dec 15 02:59:18 PST 2005


Hi Havoc,

On Thursday 15 December 2005 06:22, Havoc Pennington wrote:

> http://ometer.com/parallel.html may be helpful for understanding what's
> up with the "dbus-1.0/dbus/dbus.h" header naming.

Ah, thanks.

> I would suggest that if you can imagine using both Qt bindings in the
> same program, you want to allow:

Not possible due to symbol clashes.

> But if one program is always going to use one or the other, there's no
> point making people sed-job their headers on upgrade; then you probably
> just want:
>   #include <dbus/qt/qdbus.h>
> and have the programmer use pkg-config (or some equivalent) to select
> the right header, by getting the right -I flags. In this case you will
> probably need to install to a different directory than dbus-1.0, maybe
> you want both:
>   -I/usr/include/dbus-1.0-qt3
> and
>   -I/usr/include/dbus-1.0-qt4
>
> and then inside those have the dbus/qt/qdbus.h.

I'd like to have the includes like this
#include <dbus/qdbus.h>

They look like this in all the other bindings.
So I can either use
dbus-1.0/qt3/dbus/qdbus.h
or
dbus-1.0-qt3/dbus/qdbus.h

I just thought I'd better ask how the other bindings are planning to do this.
At the moment it seems that everbody installs right into dbus-1.0/dbus/ and I 
thought I might miss something important because I found it highly unlikely 
that not other binding library would want to support dbus in its next version 
as well.

> Anyway, I think of the -I directory as specifying the library that you
> want (it should change whenever the library name in /usr/lib changes).
> The programmer would set this up in configure.in.

Good point.

Maybe a directory structure like this should be recommended:

dbus-1.0/dbus  # dbus' own headers
dbus-1.0/name-x/dbus # headers of DBUS 1.0 bindings for lib name version x

e.g

dbus-1.0/dbus/qbus.h

dbus-1.0/qt3/dbus/qdbus.h

dbus-1.0/glib2/dbus/dbus-glib.h

The include would always be <dbus/header-name.h> and all DBUS 1.0 headers 
would still be under one common directory

Cheers,
Kevin

-- 
Kevin Krammer <kevin.krammer at gmx.at>
Qt/KDE Developer, Debian User
Moderator: www.mrunix.de (German), www.qtforum.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20051215/c6f6fbf1/attachment.pgp


More information about the dbus mailing list