dll asserts

Started by
2 comments, last by LeeIsMe 24 years ago
I have a main program that interfaces with several dlls. Sometimes the main program asks for things from the dlls, and then the dlls dynamically allocate them and give them to the main program. When the main program is done, it tries to deletes all the dynamically allocated memory in its list. Whenever it deletes thing that a dll allocated there is an error and the program crashes. How do I work around this memory allocation problem?
Advertisement
It is possibly for a DLL to use a seperate heap than its exe module. In this case calling new in the DLL and delete in the exe will not work. If these are your DLL''s you could write a function in the DLL that deletes the memory. If these are thrid party DLL''s, then off hand I don''t know of a solution - I don''t remember what causes a DLL to use a seperate heap - something to do with how you link with the RTL?
I know I can make functions in the dll to delete things, but that would complicate things too much.
You are probably using VC++ 4.0 (or something around 4), which causes a problem when the objects have virtual functions (and virtual destructors). It is a known bug in VC. If that is the case, you will have to upgrade.


- null_pointer
Sabre Multimedia

This topic is closed to new replies.

Advertisement