Re: [xml] Patches for Win32/MSCC build



Hi there,

The process to implement the Win32 DLL linkage is correct but the generated
DLL cannot be used by other compilers (like the Borland C++ Builder).

The reason is that all functions are exported according the MS name
convention.

One solution could be the usage of the  APIENTRY macro like the example:

BOOL APIENTRY xmlWriteDoc(xmlDocPtr doc,LPSTR FileName,int CompressLevel);

Comments?

Nilo

----- Original Message -----
From: "Igor Zlatkovic" <izlatkovic daenet de>
To: <xml gnome org>
Sent: sábado, 14 de abril de 2001 13:00
Subject: [xml] Patches for Win32/MSCC build


Hi there.

Here are few things regarding the Win32/MSCC build of libxml2. The patches
are made against libxml2-2.3.6.

1. MSVC project files are updated to contain newly made source files. The
project files are in the tarball named 'dspfiles.tar.gz', compressed in
order to avoid CRLF->LF conversion. These files must be in CRLF format,
because the Microsoft's IDE does not like it otherwise. All .dsp files
from
the tarball belong under win32/libxml2.

2. The file 'libxml2.def.src' is a pseudo-source file used to generate the
.DEF for the MS linker. The above project files assume it is there and
handle it properly without further intervention. It belongs under
win32/libxml2 as well. With this, we can finally make a usable shared
library under Win32/MSCC platform. The library exports 736 symbols and if
that isn't enough... I would like to thank everyone for ideas and thoughts
regarding this issue.

3. I made small change to include/libxml/xmlversion.h. Namely, this file
is
included by the above 'libxml2.def.src' and then preprocessed. After
preprocessing, a small piece of code remains in the generated .DEF file
and
MS linker feels slightly offended by that. The piece of code in question
is
a simple function prototype:

    extern void xmlCheckVersion(int version);

A small modification makes it conditional:

    #ifndef LIBXML2_COMPILING_MSCCDEF
    extern void xmlCheckVersion(int version);
    #endif /* LIBXML2_COMPILING_MSCCDEF */

This 'LIBXML2_COMPILING_MSCCDEF' macro is defined in 'libxml2.def.src'.
Under all other platform/compiler combinations, it is always undefined.
The
patch can be found in xmlversion.diff

4. include/win32config.h now has the mappings for snprintf and vsnprintf,
which are present in Microsoft's C runtime under different names. The
patch
is in win32config.diff

5. xmllint.c received a small modification which makes it compile and work
under Win32/MSCC correctly, with disabled timings. The patch is in
xmllint.diff

I wish you all a nice weekend
Igor







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