syntheticpp at gmx.net
Sun Sep 10 12:27:05 PDT 2006
Havoc Pennington wrote:
> For people working on the Windows port - I think it's important not to
> take UNIX emulation too far. For example, the unix: addresses should
> fail on Windows, i.e. don't try to emulate
> dbus_(connect,listen)_unix_socket on Windows. Instead, a
> Windows-specific appropriate mechanism should be used, whatever it is.
> Maybe Windows always uses tcp: for now.
> Essentially, any emulate-unix-on-windows hacks should stay internal and
> not leak out into config files, bus addresses, or the public API.
Yes this is a clean solution.
> The public functions with _unix in the name should always return an
> error on Windows, they should not do emulation stuff.
Even better to catch such thing at compile time.
> One thing I think might help with this is a dbus-sysdeps-unix.h header
> that has the stuff from dbus-sysdeps.h which is truly unix-specific,
> like the unix socket functions. Then be sure this header is not included
> on Windows - perhaps put a #error "not on windows" in there if it is.
> I think in an ideal world, a fair bit of dbus-sysdeps.h is either in
> dbus-sysdeps-unix.h or gets modified to be less unix-like, e.g.
> returning a DBusError instead of setting errno, etc.
Is in an ideal world a sysdeps file which does not depend on the system?
Maybe this is in general the wrong name for this file.
> To start though, a few of the major items like unix sockets might make
> sense in dbus-sysdeps-unix.h.
Currently we also think about how to solve the problem that open/close...
could be called for sockets, pipes, and files on unix but not on windows.
At the moment we have the descriptors with something like "home made
RTTI in C", but this is not a solid solution of the problem, because
errors will be caught at runtime not compile time.
For the windows code it would be best to drop the indistinguishably
of the descriptors and to introduce types for each resource:
DBusFile, DBusSocket, DBusPipe, then with functions like
_dbus_open_file, _dbus_open_socket,... errors are caught at
compile time and we don't need to encode the descriptors with
the some type information.
Is this the right way to handle this or has it no chance
to go into cvs?
More information about the dbus