Re: [GD-Windows] new/delete across DLL's
Brought to you by:
vexxed72
From: Adrian C. <ce...@ce...> - 2003-03-25 20:52:33
|
Sorry I didn't read all the replies to tis message, I just had to take the chance that this was already solved. The way we solved this in OGRE (which is a library that links dynamically) was to create our own memory manager class (based in the debug version on Paul Nettle's *very* *very* nice one) which makes sure that all the calls to *alloc/free and new/delete are mapped to static member functions of this memory manager class I told you about later. The end product is that all the memory gets (de)allocated only in the main DLL's thread. The side-effect is that you have to include the memory manager's header file in all the other DLL's as well as in the client application. My 2c, Adrian 'cearny' Cearnau ----- Original Message ----- From: "Ben Hawes" <cr...@ca...> To: <gam...@li...> Sent: Monday, March 24, 2003 7:07 PM Subject: [GD-Windows] new/delete across DLL's Am I doing something wrong, or is this correct behaviour: in core.dll I have a class CFooBar. in the game exe, I call wibble = new CFooBar; Later on, within the exe, I call delete wibble; and get an Assert warning because I'm deallocating from the wrong heap. This seems very strange, that I can only deallocate a class defined in a DLL from within that DLL, even if the instance was allocated somewhere else. Am I understanding this correctly, or am I doing something else to cause the problem? Is there any way round this? [ cruise / casual-tempest.net / transference.org ] ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_idU5 |