RE: [xml] libxml2 and problems with Borland's handling of DLLs



On Thursday, 15 August 2002 11:22 AM, I all too hastily wrote;


I'm trying to make use of the libxml2 DLL with Borland compilers (both
Delphi and C++ Builder). This is mostly working beautifully, but there
seem
to be some problems which I think are related to the way Borland handles
the
importing of symbols from DLLS. It appears as if the Borland  compilers do
not "know" about DATA in DLLS - only about functions. If  fact, the Delphi
help categorically states that "Global variables declared in a shared
library cannot be imported by an Object Pascal application".  The
C++Builder
documentation is less clear, but seems to have a similar constraint.

This becomes a critical problem chiefly with the memory management
functions: xmlFree, xmlMalloc, xmlRealloc, and xmlMemStrdup (but note that
it also affects access to other variables, such as xmlParserVersion).
These
memory "functions" are actually pointers to the functions themselves.

It turns out that this was all my own stupid fault. The trick is simply to
make sure that the macro LIBXML_DLL_IMPORT is correctly defined as
__declspec(ddlimport) when compiling any application that accesses the DLL.
Get that right and it works perfectly with C++Builder (though Delphi remains
a bit trickier).

Eric Zurcher
CSIRO Livestock Industries
Canberra, Australia
Eric Zurcher csiro au



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]