Re: XML_LARGE_SIZE binary compatibility problem

Karl Waclawek <[email protected]>
Newsgroups gmane.text.xml.expat.general
Message-ID <[email protected]>
Bruno Haible wrote:
> 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.
>
>   
The standard build is without XML_LARGE_SIZE defined. Therefore your 
program should
rely on that ABI. We introduced this compile option only for special 
needs, where one needs
to get the line/column number when processing extremely large files. In 
this case you would
create a custom build of libexpat and you would know that you need to 
define XML_LARGE_SIZE
when compiling your application to get the correct header files.

We could add a new return value to XML_GetFeatureList(), so that you can 
dynamically
detect if XML_LARGE_SIZE was used. Would that help you?

Karl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.