RE: [xml] Win32/MSVC Facelift



Hi there.

This way we remove the need for the .def.src and have a 
consistent way to
import/export both functions and variables.

  Okay, if Igor things it's the Right Way, then provide a patch :-)

It is not The Right Way, but it is close :-) We have two different
problematics here. The one is export/import declaration and
specification of the calling convention in the header files. The other
is the struct alignment. These two are different things.


1. Import/Export & Calling Convention Macros
--------------------------------------------

If we populate the headers with these macros, then use a macro per
purpose, rather then packing the calling convention and export/import
declaration in the single macro. I mean, instead of having

  #define XMLAPI @export_decl@ @call_conv@
  #define XMLVAR @export_decl@

I would rather see

  #define XMLPUBLIC @export_decl@
  #define XMLCALL   @call_conv@

With this, each function would be preceded by XMLCALL, exportable
function would additionally end up preceeded by XMLPUBLIC and exportable
variable would be preceeded by XMLPUBLIC. Then a declaration would be a
thing far easier to understand:

  XMLPUBLIC int XMLCALL xmlSomeFunc(int arg);
  XMLPUBLIC int xmlSomeVar;

Now, that is The Right Highway, not true?

Now to the other side of the world. Even if the patch for this is
provided, I allready see myself hunting and redeclaring newly added
functions and variables across libxml headers. Sigh... Well, in the end,
doing that would perhaps be easier than keeping the .def.src up-to-date.

One thing I would like to know: I allready proposed this thing before I
made the .def.src file. Back then, I had posts against it, because few
people didn't like the idea of messing up the headers. What is making
those think otherwise now, as I see no complaints? Perhaps people don't
read this because it says 'Win32' in the subject and once the headers
are modified, the mass shall start cursing?


2. Struct Alignment
-------------------

What this takes is 

  #if defined _MSC_VER
  #pragma pack(push, 8)
  #endif

at the beginning of every header file and a

  #if defined _MSC_VER
  #pragma pack(pop)
  #endif

at the end of every header file. Wanna have this in all headers? After a
time, one gets used to it, I must admit :-)) I am still against it, but
that is parhaps because I look at it every day and find relief when I
can see a header which doesn't begin that way :-))

Ciao
Igor




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]