httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clark Cooper <>
Subject Giving expat (XML parser engine) its own sharable library
Date Fri, 23 Jun 2000 02:37:14 GMT


I'm the maintainer of perl's XML::Parser module, which uses the expat
engine. Matt Sergeant (among others) ran into problems when trying to
use the XML::Parser module with mod_perl and other Apache modules that
use expat.

The problem arises since expat, as distributed, does not build a library.
Therefore authors that use expat tend to link into a single library
expat plus other functions used by their module.

This represents a problem when more than one module uses expat. The Apache
loader (rightly) complains about multiple instances of symbols used by expat.

The solution seems to be to package up a version of expat that builds a
sharable library.

There's a further issue from my point of view. XML::Parser depends on features
that I've added to the version of expat that I distribute with the module.
I've sent the patches (which amount to about 1700 context diff lines) to
James Clark, but I've never gotten any feedback from him. These patches
include handlers for element and attlist declarations.

If I were to package up perl expat to build into a sharable library, I would
need to come up with a configuration system. I don't currently face this
since I'm able to ride on perl's configuration information. But a stand alone
library package can't count on perl being there... Or maybe it could.

Would it be an onerous restriction (for a library distributed through the
Apache organization) to require that a perl installation be available during
the build?

Also does this make sense as a mod_expat or as a library used by mod_xxxx?

As a less ambitious, pragmatic, quick fix (i.e. ugly hack), we could run
multiple versions of expat by placing something like this at the top of


/* I'd really like to do "#define NAME(a) NAME_PREFIX ## a"
   but that doesn't do what you expect */

#if NAME_PREFIX == 2
#define NAME(a) XP2_ ## a
#if NAME_PREFIX == 3
#define NAME(a) XP3_ ## a
#if NAME_PREFIX == 4
#define NAME(a) XP4_ ## a
#define NAME(a) XP_ ## a

#define XML_Parse NAME(XML_Parse)
#define XML_ParserCreate NAME(XML_ParserCreate)
#define XML_SetElementHandler NAME(XML_SetElementHandler)
#define XML_SetCharacterDataHandler NAME(XML_SetCharacterDataHandler)
/* ... */


I'd like to help solve this problem and I'm ready for any advice you folks
can offer.

Clark Cooper		Software Engineer	Home:
			Schenectady, NY	USA	Work:

View raw message