Re: [xml] windows binary with different calling
- From: "Zlatkovic, Igor" <Igor Zlatkovic Dresdner-Bank com>
- To: "'xml gnome org'" <xml gnome org>
- Subject: Re: [xml] windows binary with different calling
- Date: Wed, 4 Jun 2003 10:23:44 +0200
Personally (as one of those miserable Windows developers) I'd be
happy if the header files included a macro as part the declaration
of every function which is part of the libxml2 API. The macro
would be analogous to the LIBXML_DLL_IMPORT macro already in place
for variables. The macro could be named something like
"LIBXML_ENTRYPOINT" or "LIBXML_API".
In the Windows enviroment, the macro could expand to something
like "__cdecl __declspec(dllexport)" when building the DLL
(thereby eliminating the need for a .def file!), and
"__cdecl __declspec(dllimport)" when building applications which
use the DLL. In the Linux world, the macro could expand to an empty
string, just like it does with LIBXML_DLL_IMPORT.
This was discussed thoroughly about two years ago. You cannot put cdecl and
dllexport in the same macro. To keep things small, I'll put two macros
XMLPUBLIC and XMLCALL. It should be obvious to what these expand. A typical
function prototype would then be
XMLPUBLIC int XMLCALL xmlSomeFunc(int arg);
Note that the return type must be between the two macros, or you'll get
compiler errors when the return type is a pointer. Now check the previous
discussion
http://mail.gnome.org/archives/xml/2001-July/msg00143.html
and see that Daniel has put a veto on that.
This might seem like this change would be of benefit to Windows
developers only, but I suspect that it would also be of use on one
or two other platforms (maybe VMS?). What is more, it would have
the added benefit of providing a convention for distinguishing
those functions which are designed to be truly part of the libxml2
API from those which are intended for "internal use only".
Doing this would mean that when Daniel makes an interface like xmlreader
next time, he must use these macros in every function. Should he forget
them, his platform won't suffer. But mine will and then I am the one to walk
the headers and patch the function declarations. No, thanks. Now I have a
fully automatic .def file and really don't need the stuff like calling
convention.
If someone must have it, fine. She must first have Daniel agree with it,
that alone is nothing short of hopeless, then not only modify the headers
but also be prepared to maintain these declarative jewelry in the future.
Ciao,
Igor
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]