Re: [libxml++] MS Visual 2005 - Return object across DLL boundary?(Was: Another issue)
- From: Loïc Joly <loic joly reportive com>
- To: <EricBeyelerMQ aol com>, <libxmlplusplus-general lists sourceforge net>
- Subject: Re: [libxml++] MS Visual 2005 - Return object across DLL boundary?(Was: Another issue)
- Date: Tue, 10 Oct 2006 09:13:07 +0200
> Is there are known workaround, or proposed fix?
>
> Thanks,
> Eric
Have you read my previous message on the subject ? I use libxml++ with several DLL on VC++2005, and have not encountered any problems.
To my understanding, there is another way to acheive this :
If you select the Multi-threaded DLL (/MD) options, all allocations/deallocations, either from the main program or from the DLL are delegated to yet another DLL (MSVCR80.DLL) (which must then be delivered with the program), and thus happen in a unique place.
Of course, the main program and all its DLL should be compile with the same option.
--
Loïc
>
> ----Original Message----
> On Wed, 2006-07-19 at 13:34 -0400, Robert S. Grimes wrote:
> [snip]
> > This seems to say the object was created on another heap
> (libxml++ DLL's
> > heap?) and being deleted by my code (using the main
> heap?). It seems the
> > "return value optimization" has been applied, and it
> perhaps shouldn't have
> > been. Does this make any sense? If so, what do I do
> about it? Or am I
> > missing something even more obvious?
>
> This looks the annoying MSVC++ requirement that memory is
> deallocated in
> the same library (DLL) in which it was allocated. So, if a
> library gives
> you a newly allocated object, you can't delete it yourself.
> You have to
> tell the library to delete it. libsigc++ used to have this same
> problem.
>
> You can usually fix this by making sure that, though the deletion is
> initiated in the caller, the actual deletion happens in
> some function in
> the library. Which would require a patch.
>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]