Sharing memory with DLLs
I''ve spent hours debugging my program, and I''ve finally come to a simple conclusion:
When memory is allocated in a DLL (loaded with LoadLibrary/GetProcAddress), it crashes when trying to release the memory.
When memory is allocated in the same thread that releases it, it works fine.
Doesn''t windows allow different modules to release each others memory, and will I have to have a function for releasing that memory in the DLL too?
For crying out loud, she has fishes coming out of her head on either side. How can you find this hot?!
Use the DLL versions of the runtime libraries in your project settings. This will get rid of your memory allocation/deallocation problems.
Hmmm... I''ve been looking for a setting like that, but I can''t seem to find it (I just switched to VC .NET)... Shouldn''t it be in General or perhaps Linker options?
For crying out loud, she has fishes coming out of her head on either side. How can you find this hot?!
For crying out loud, she has fishes coming out of her head on either side. How can you find this hot?!
Project -> Properties -> Configuration Properties -> C/C++ -> Code Generation -> Runtime Library
Select Multithreaded DLL (or Multithreaded DLL Debug for a Debug build)
Select Multithreaded DLL (or Multithreaded DLL Debug for a Debug build)
Thanks a lot! (How could I miss that?)
EDIT: Damn! It STILL crashes!
EDIT again: This is damn weird! I wrote a memory deallocation function in the very same DLL, and it STILL crashes!
For crying out loud, she has fishes coming out of her head on either side. How can you find this hot?!
[edited by - Valderman on June 18, 2003 4:19:46 PM]
EDIT: Damn! It STILL crashes!
EDIT again: This is damn weird! I wrote a memory deallocation function in the very same DLL, and it STILL crashes!
For crying out loud, she has fishes coming out of her head on either side. How can you find this hot?!
[edited by - Valderman on June 18, 2003 4:19:46 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement