Re: [xml] MinGW fixes for 2.2.7

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Tue Nov 07 2000 - 08:28:48 EST


On Sun, Nov 05, 2000 at 11:18:01PM -0800, Wayne Davison wrote:
> The addition of the external error-reporting variables in 2.2.7 broke the
> linking of testHTML and testSAX against the *.dll version of libxml (when
> building using the MinGW compiler for Win32). To fix it, I needed to add
> "__declspec(dllimport)" to the external variables, but only when they are
> included from code that is outside the DLL.

  <grin/> Is this really MinGW specific or do other compilers have this
kind of annoying behaviour. I remember the feedback from someone who
ported to the PSion who was complaining about global variable use. At least
at the API level, that's right that a purely procedural interface sounds
better.

> The solution is to define LIBXML_DLL_IMPORT as nothing when creating code
> that goes in the DLL, and as the aforementioned incantation for library-
> using code. I chose to put the empty define into "win32config.h" (which
> was not being included by hash.c, so I fixed that), and to put the

 ohh, right !
 
> conditional define of the magic version into xmlversion.h[.in] (which was
> included by all the macro-using .h headers through their direct/indirect
> inclusion of tree.h).

  Hum, this seems a bit complex, but unless redesigning the API to avoid
any global variable sharing between the library and the app there is no
obvious solution it seems. Probably a good incentive to rework the API
to at least allow to use function to get the variable content.

> I think I found and changed all external variable references in the .h
> files. (I also eliminated the word "extern" from a few function
> prototypes in xmlmemory.h, just for consistency's sake.)

  okay, thanks,

> Because the files testHTML.c and testSAX.c include both the win32config.h
> include and expect to link with the DLL, I had to manually undefine the
> LIBXML_DLL_IMPORT macro. Normal code that uses the DLL won't have
> included win32config.h, so this shouldn't be a problem.

  Right, sounds good.

> The patch is appended.

  Thanks, I applied it, but I wonder if there isn't the need for a deeper
change of the API. Well this solution is good enough for now.

Daniel

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | libxml Gnome XML toolkit
Tel : +33 476 615 257  | 655, avenue de l'Europe | http://xmlsoft.org/
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Rpmfind search site
 http://www.w3.org/People/all#veillard%40w3.org  | http://rpmfind.net/
----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Nov 07 2000 - 09:43:39 EST