The project I am working on makes use of Xerces-C on Win2000, Solaris, and
Mac. I have run into a problem on Windows and Solaris. When I attempt to
delete the memory allocated during a transcode, I get an illegal memory
access.
On Win2000, my project makes use of the Multithreaded runtime library. This
cannot be changed, so I linked Xerces-C to the Multithreaded runtime library
as well (instead of the Multithreaded DLL runtime library which is the
default). This prevented the mixing of runtimes, but the error persisted.
After digging throught the MSDN, I discovered that a DLL that links to the
Multithreaded runtime library will allocate its own heap, independent of the
heap allocated by applications that use the DLL. This happens even though
both the application and DLL link to the Multithreaded runtime library.
Since Xerces-C is distributed as a DLL, the pointer returned from
Transcode() references memory allocated in the DLL's heap. An error occurs
when an attempt is made to delete this pointer from an application using the
DLL.
So to use Xerces-C on Windows, one has basically has two options: 1) To
convert Xerces-C to a statically linked library, so that the heap used by
Xerces-C is the same as that of the application, or 2) To have your
application use the Multithreaded DLL runtime library so that once again the
heaps are the same.
I have received the same problem on UNIX and am currently in the process of
converting Xerces-C from a shared to static library.
Has anyone else run into these problems? Do these problems exist on Mac as
well (I haven't implemented the code there yet)? Would a possible solution
to all this be to provide a method on DOMString that takes a pointer to the
memory returned by Transcode() and deletes it for you?
Thanks for any help,
Ray
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]