[Expat-discuss] Using expat in "wide mode" on systems with 32-bit wchar_t's

Jeff Garbers jgarbers@xltsoftware.com
Wed, 11 Sep 2002 13:50:35 -0400


Thanks to Karl for his kind help with my previous posting. I'm now able
to build expat successfully 
with XML_UNICODE_WCHAR_T. My test code shows that libexpatw.a is indeed
returning 16-bit characters.

Now, however, another problem arises on systems that define wchar_t to
be 32 bits wide -- like GCC on the iMac and 
Linux boxes I'm using. I can build my own code in 16-bit wchar mode by
using the -fshort-wchar option (at least on
Linux; that doesn't appear to work on Mac OS X). That lets my code talk
to expat successfully... but now none of the
wide string functions from the standard library will work, since they're
all compiled for 32-bit wchar_t's.

So my question is for folks who've used expat in its "wide mode" on
systems with a 32-bit wchar_t: how do you deal
with it? Do you just expand everything coming out of expat into a wider
buffer before operating on it? Do you avoid
using the built-in wide string functions? Or is there a trick I haven't
discovered yet?

Thanks again to all for your help.

Jeff Garbers
jgarbers@xltsoftware.com