[Expat-discuss] XML_LARGE_SIZE binary compatibility problem

Bruno Haible bruno at clisp.org
Fri Apr 7 14:18:10 CEST 2006


Hello,

In expat-2.0.0, a compilation option XML_LARGE_SIZE has been introduced that,
on 32-bit systems, changes the size of the return type of the functions
  XML_GetCurrentLineNumber
  XML_GetCurrentColumnNumber
  XML_GetCurrentByteIndex
from 32-bit ([unsigned] long) to 64-bit ([unsigned] long long).

The ABI is not the same: on some CPUs 64-bit results are returned in memory,
and on the other CPUs, where 64-bit results are returned in registers, the
registers for 32-bit return and 64-bit return may not be the same.

Question 1:
How should a program that wants to use <expat.h> and -lexpat proceed?
The installed expat.h and expat_external.h are the same in both cases.
In other words, someone using the expat.m4 macro in his package and
doing #include <expat.h> will be assuming that the return types are
32-bit large, while in the libexpat.so.1 they are actually 64-bit large.

Question 2:
How should a program that wants to use libexpat.so through dynamic loading
(dlopen ("libexpat.so.1")) proceed? The list of exported symbols that are
visible through dlsym() is the same in both cases. How can it know whether
the library was built with XML_LARGE_SIZE or not?

If these issues are not resolved, there is no way to make my program (GNU gettext)
link against libexpat without risking crashes, and I will have to rewrite my
code to use libxml2 instead of libexpat.

Bruno



More information about the Expat-discuss mailing list