At 03:44 PM 25/10/2001 -0400, Nicholas G. Lesniewski-Laas wrote:
>Hi, I hope I don't come off as sounding stupid or ridiculously ignorant, 
>but I can't for the life of me figure out why I can not compile Xerces 
>client programs, or even Xerces itself, with the free Borland C++ 5.5 compiler.
>
>Compiling the Examples:
>
>When attempting to compile client programs, I'm scolded with the infamous 
>"Unresolved External" errors.  I understand this means that there is an 
>error in the OMF import library I'm trying to use.  I've tried "implib"ing 
>the Xerces DLLs.  This proved ineffective in fending off those "unresolved 
>externals".  Next I tried using Borland's "COFF2OMF" program to convert 
>the import libraries supplied with the Xerces package into usable OMF 
>import libraries.  Again, failure.  I decided that the only way I could 
>think of to get rid of these blasted errors was to compile the Xerces 
>library source with BCC, because I figured there may have been a Visual 
>C++ induced annoyance in the DLL supplied with the package.

The OMF issue is a red-herring here. The Win32 DLL that is released is 
compiled with MSVC, who use a different mangling scheme for C++ to Borland. 
One of the annoying things about C++ is that in practice any C++ libraries 
you use must be compiled with the same compiler.

This means the only way to use Xerces with Borland C/C++ 5.5 is the second 
option you tried...

>Compiling the Xerces Source:
>
>Frustrated over my inability to compile the sample programs that came in 
>the Xerces package, I attempted to compile the Xerces source.  And what 
>did I find when I unzipped the Xerces-src package?  I found nice little 
>project files supporting various C++ compilers, but not the one I was 
>trying to use.  True, there is the BCB4 project, which almost worked 
>except for the fact that the free Borland compiler does not come with the 
>VCL library, which is necessary to compile the Xerces BCB project.  I had 
>not lost hope just yet, as I could think of a few different ways in which 
>I could perhaps avoid the VCL libraries, or perhaps even download 
>them.  Alas, all my efforts were for not, and I finally accepted defeat.

The next version of Xerces-C will come with a build project for BCB5, I 
believe. This isn't as good as makefiles for using the free BCPP5.5 
command-line tools, but it might be better.

In the meantime, it _is_ possible to build the Xerces-C library manually. I 
found the best way to do this is to start with the MSVC makefiles, and use 
them to hand-create makefiles for use with Borland. With this method, I ran 
into a few problems:

1) Building a DLL was unreliable. I can't remember the exact problems now, 
but it was error-prone. This was probably my fault, and related to the 
issue of passing dynamically-allocated memory across DLL boundaries (which 
happens with every transcode() call. Bad design here, on the part of 
Xerces, but we should bitch about that somewhere else).

2) Building Xerces as a static library works, but can leak incredible 
amounts of memory. Specifically, every parse of a file with external entity 
references (eg, an external DTD) leaks about 128KB of memory. This proved 
very difficult to track down.

I thought about submitting my build process, but to be honest it's a bit 
messy and probably doesn't do things correctly. If anyone is interested, I 
don't mind sending them what I've done but I won't have much time to help 
with fixing the problems.

Hopefully the BCB5 project in the next release will make things a lot 
easier for all of us, as well as increase the userbase interested in 
tracking down the memory leak.

Cheers,

  - Andrew



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to