Skip to main content
gamedev.net
🔒 Locked

DLL question

Started by Keba Aug 2, 2005 at 12:13 PM 2 replies 400+ views
Original Post
Keba
Keba
Hello, i noticed that if you allocate some memory, let say the client part, and then deallocate it in the DLL you get an unhandled exception. Now i wounder why? and is it possible to deallocate something in a DLL that have been allocated somewhere else. thanks.
DigitalDelusion
DigitalDelusion
generally speaking you don't don't want todo that, allocation/deallocation should be contained on whatever side of the dll boundry it originated from.
HardDrop - hard link shell extension."Tread softly because you tread on my dreams" - Yeats
chollida1
chollida1
If you link your dll and app against the dll version of the std runtime then each of htem will have their own seperate heap. allocating in one and deleting in another causes you to try to delete memory allocated in another heap, hence the exception.

Cheers
Chris
CheersChris
Galapaegos
Galapaegos
Keba,

If you don't want to change this, you can write a custom memory allocator so everything comes from the same heap. But you'll have to use google on writing your own.

-brad
-brad

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.