RE: [xml] Problem when building libxml2 with Borland C++ 6



OK. Here's a patch that works, and while still somewhat ugly, isn't
completely replusive:

--------------------------------

Index: include/wsockcompat.h
===================================================================
RCS file: /cvs/gnome/libxml2/include/wsockcompat.h,v
retrieving revision 1.3
diff -u -r1.3 wsockcompat.h
--- include/wsockcompat.h       4 Jan 2006 09:55:16 -0000       1.3
+++ include/wsockcompat.h       9 Feb 2006 02:29:16 -0000
@@ -10,6 +10,9 @@
 #else
 #undef HAVE_ERRNO_H
 #include <winsock2.h>
+#if defined(__BORLANDC__) && !defined(__cplusplus)
+#define inline __inline
+#endif
 #include <ws2tcpip.h>
 /* Check if ws2tcpip.h is a recent version which provides getaddrinfo()
*/
 #if defined(GetAddrInfo) 

--------------------------------

It turns out that the Borland compiler has an __inline keyword for C,
equivalent to the standard inline keyword for C++. This just makes use
of it.

Of course, this solution is still not ideal, since the fix really should
be in the ws2tcpip.h distributed by Borland, not here in libxml2.

Eric Zurcher
CSIRO Plant Industry
Canberra, Australia
Eric Zurcher csiro au 

-----Original Message-----
From: Daniel Veillard [mailto:veillard redhat com] 
Sent: Wednesday, 8 February 2006 5:15 AM
To: Zurcher, Eric (PI, Black Mountain)
Cc: xml gnome org
Subject: Re: [xml] Problem when building libxml2 with Borland C++ 6

On Tue, Feb 07, 2006 at 12:03:22PM +1100, Eric Zurcher csiro au wrote:
Hi,

I have recently learned that the libxml2 does not build with BCB6. The
problem is the result of the inclusion of the Windows header file
ws2tcpip.h by wsockcompat.h. The ws2tcpip.h header file (apparently
supplied to Borland by Microsoft) uses a macro, WS2TCPIP_INLINE, which
on non-Microsoft compilers gets defined as "extern inline". That's
fine
for C++ compilation, but the "inline" directive is not recognized by
BCB
when doing standard C compilation.

Arguably this is really a problem in the Borland header file, but it
would be nice if libxml2 could be compiled without having to modify
the
distributed headers. The best patch I've been able to come up with so
far is this:

------------------------------------

Index: include/wsockcompat.h
===================================================================
RCS file: /cvs/gnome/libxml2/include/wsockcompat.h,v
retrieving revision 1.3
diff -u -r1.3 wsockcompat.h
--- include/wsockcompat.h     4 Jan 2006 09:55:16 -0000       1.3
+++ include/wsockcompat.h     7 Feb 2006 00:54:03 -0000
@@ -10,7 +10,15 @@
 #else
 #undef HAVE_ERRNO_H
 #include <winsock2.h>
+#if defined(__BORLANDC__) && !defined(__cplusplus)
+#define extern static
+#define inline
 #include <ws2tcpip.h>
+#undef extern
+#undef inline
+#else
+#include <ws2tcpip.h>
+#endif
 /* Check if ws2tcpip.h is a recent version which provides
getaddrinfo()
*/
 #if defined(GetAddrInfo)
 #define HAVE_GETADDRINFO

------------------------------------

This doesn't seem very elegant, though. Anyone have any better ideas?

  Gasp, yes that's really not nice, I would really prefer if someone 
could come with a nicer way to do this.
  Aren't Borland header using guards to avoid double definitions, maybe
something like this could be used instead.

Daniel

-- 
Daniel Veillard      | Red Hat http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit
http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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