Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Running DLLs from mixed MsDev versions

Reply
Thread Tools

Running DLLs from mixed MsDev versions

 
 
Yuval Steinberg
Guest
Posts: n/a
 
      09-16-2010
Hello,
Recently we've upgraded to use MsDev 2008 for our code (until now
we've used MsDev 2005).

Unfortunately we are using some 3rd party DLLs that were build in
MsDev 2005, and there are a few methods in those DLL that are
allocating memory, which I as a client need to free. I have no control
of them, so I cannot change the interface or the way memory
allocations work, nor is there a way for us to recieve these DLLs
build with MsDev 2008. There are also some places where allocations
are done on our side and are freed by their DLL (I know this is bad
exercise, but that's they way the 3rd party enforces....)

As you can guess - our software crashes because of this mixture
(memory allocations are done with MSVCR80 and freed with MSVCR90, or
viceversa, causing different heaps to be used...).
My question: Is there a way to enforce the 3rd party DLL to use the
same heap (i.e. use MSVCR90) as my software? I'm really lost...


BTW - I've investigated it and I must add that even there was no cross
memory allocation/deallocation, there are still problems when running
with several heaps - if memory is not freed (and say that it is still
used, no leak), then each page taken by a heap is not available for
the other heap. So if the other DLL needs a lot of space at some point
and frees most of it, but still takes many pages, my main program is
left with less available heap then expected.
 
Reply With Quote
 
 
 
 
Alf P. Steinbach /Usenet
Guest
Posts: n/a
 
      09-16-2010
* Yuval Steinberg, on 16.09.2010 22:41:
> Hello,
> Recently we've upgraded to use MsDev 2008 for our code (until now
> we've used MsDev 2005).
>
> Unfortunately we are using some 3rd party DLLs that were build in
> MsDev 2005, and there are a few methods in those DLL that are
> allocating memory, which I as a client need to free. I have no control
> of them, so I cannot change the interface or the way memory
> allocations work, nor is there a way for us to recieve these DLLs
> build with MsDev 2008. There are also some places where allocations
> are done on our side and are freed by their DLL (I know this is bad
> exercise, but that's they way the 3rd party enforces....)
>
> As you can guess - our software crashes because of this mixture
> (memory allocations are done with MSVCR80 and freed with MSVCR90, or
> viceversa, causing different heaps to be used...).
> My question: Is there a way to enforce the 3rd party DLL to use the
> same heap (i.e. use MSVCR90) as my software? I'm really lost...
>
>
> BTW - I've investigated it and I must add that even there was no cross
> memory allocation/deallocation, there are still problems when running
> with several heaps - if memory is not freed (and say that it is still
> used, no leak), then each page taken by a heap is not available for
> the other heap. So if the other DLL needs a lot of space at some point
> and frees most of it, but still takes many pages, my main program is
> left with less available heap then expected.


If you ask in an on-topic group I'm sure somebody will outline how to link your
main code with MSVCR80 instead of MSVCR90.

As a stopgap measure you can just implement a DLL that uses MSVCR80 (runtime
DLL) and provide allocation and deallocation operations.

For a longer perspective, stop using badly designed 3rd party software.


Cheers & hth.,

- Alf

--
blog at <url: http://alfps.wordpress.com>
 
Reply With Quote
 
 
 
 
Francesco S. Carta
Guest
Posts: n/a
 
      09-16-2010
Yuval Steinberg <>, on 16/09/2010 13:41:24, wrote:

> Hello,
> Recently we've upgraded to use MsDev 2008 for our code (until now
> we've used MsDev 2005).
>
> Unfortunately we are using some 3rd party DLLs that were build in
> MsDev 2005, and there are a few methods in those DLL that are
> allocating memory, which I as a client need to free. I have no control
> of them, so I cannot change the interface or the way memory
> allocations work, nor is there a way for us to recieve these DLLs
> build with MsDev 2008. There are also some places where allocations
> are done on our side and are freed by their DLL (I know this is bad
> exercise, but that's they way the 3rd party enforces....)
>
> As you can guess - our software crashes because of this mixture
> (memory allocations are done with MSVCR80 and freed with MSVCR90, or
> viceversa, causing different heaps to be used...).
> My question: Is there a way to enforce the 3rd party DLL to use the
> same heap (i.e. use MSVCR90) as my software? I'm really lost...
>
>
> BTW - I've investigated it and I must add that even there was no cross
> memory allocation/deallocation, there are still problems when running
> with several heaps - if memory is not freed (and say that it is still
> used, no leak), then each page taken by a heap is not available for
> the other heap. So if the other DLL needs a lot of space at some point
> and frees most of it, but still takes many pages, my main program is
> left with less available heap then expected.


Well, you have some chance to get sensible help here, although you're
way off topic - yours is a very platform/implementation specific issue,
nothing to do with C++ as /language/, which is what this group focuses on.

I can only wish you good luck and suggest you to start looking for an
appropriate group or forum that focuses on your platform &&
implementation, to increase the chances to get effective help.

--
FSC - http://userscripts.org/scripts/show/59948
http://fscode.altervista.org - http://sardinias.com
 
Reply With Quote
 
Yuval Steinberg
Guest
Posts: n/a
 
      09-16-2010
Thanks for the quick answer. SOme but some inline response

> If you ask in an on-topic group I'm sure somebody will outline how to link your
> main code with MSVCR80 instead of MSVCR90.

I'm not sure I understood this answer..
>
> As a stopgap measure you can just implement a DLL that uses MSVCR80 (runtime
> DLL) and provide allocation and deallocation operations.

That's what we have been doing so far, though I don't like it. As I
said, there is still a downside of memory fragmentation caused by it
(that is build-in such a solution and should not be overlooked), and I
would really want to know if there is a way to force that 3rd party to
run with the same heap.

>
> For a longer perspective, stop using badly designed 3rd party software.

Perhaps you're correct, but this is not an option in this case. This
is a client DLL that implements private protocols for communicating
with their server. That is the game I have to play and I can't change
the rules.
>
> Cheers & hth.,
>
> - Alf
>
> --
> blog at <url:http://alfps.wordpress.com>


 
Reply With Quote
 
Goran
Guest
Posts: n/a
 
      09-18-2010
On Sep 16, 10:41*pm, Yuval Steinberg <yuval.steinb...@gmail.com>
wrote:
> Hello,
> Recently we've upgraded to use MsDev 2008 for our code (until now
> we've used MsDev 2005).
>
> Unfortunately we are using some 3rd party DLLs that were build in
> MsDev 2005, and there are a few methods in those DLL that are
> allocating memory, which I as a client need to free. I have no control
> of them, so I cannot change the interface or the way memory
> allocations work, nor is there a way for us to recieve these DLLs
> build with MsDev 2008. There are also some places where allocations
> are done on our side and are freed by their DLL (I know this is bad
> exercise, but that's they way the 3rd party enforces....)


Question has already been answered, I'll just add that original
project management failure is that you have libraries that effectively
tie you into use of an eventually obsolete toolchain. It's possible
that you had no dealing whatsoever in that decision, but I kinda feel
this should be said.

Goran.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Redirecting CPP and LINK32 in MSDEV 6.0 to another compiler. Shawn Campbell C++ 1 05-21-2004 05:53 PM
msdev /make problem oguz C++ 2 12-15-2003 02:47 AM
Is this a bug in g++ or MSDEV? jesse C++ 7 11-06-2003 03:55 AM
Pointers to non-static member functions, compiles with MSDEV, but not with GCC John Doe C++ 9 10-23-2003 10:01 PM
MSDEV - auto-complete for user defined classes? Robert Oschler Javascript 0 09-27-2003 12:44 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57