Win32 Port of D-Bus

Tor Lillqvist tml at iki.fi
Tue Apr 25 00:50:13 PDT 2006


>> DBUS_API DBusConnection*  dbus_connection_open (const char *address,
>> DBusError *error);

 > When using a function from a DLL on Windows, the normal way is that the 
 > function is declared __declspec(dllimport). The user code won't need any 
 > special modification to compile and link.

 > they need special compiler and/or linker options to let the
 > compiler/linker know that some of the functions are to be imported.

Hmm, I think you are confused. Even without __declspec(dllimport),
user code that calls such functions don't need any special
modifications or options. Having the dllimport declaration just makes
the calls a tiny bit faster as they don't go through the stubs from
the import library.

(For variables that are imported from DLLs the situation is different,
they *must* be declared as dllimport to be referenced correctly in
user code.)

The more important reason for decortaing functions with macros like
this is to explicitly specify the calling convention to be used. But
even that is not terribly important. Glib, gtk, etc and apps that use
them get along fine without. (Many other libraries, though, do feel
that they need to specify calling convention in the headers.)

--tml



More information about the dbus mailing list