Re: [GD-Windows] new/delete across DLL's
Brought to you by:
vexxed72
From: Javier A. <ja...@py...> - 2003-03-24 19:16:30
|
I never had to use this myself since we always have virtualized and/or strong-ownership interfaces in our DLLs. IIRC the idea was like this: every module has its own Windows heap. EXE and DLL files are distinct modules, thus have different heaps. If you use the runtime in its DLL form, your new/malloc calls (and delete/free) end up being processed by the runtime DLL, thus only one heap is ever used for this purpose. Rich wrote: > In article <005b01c2f233$ede559c0$7b02000a@mcaf.local>, > "Javier Arevalo" <ja...@py...> writes: > >> If both the EXE and your DLL link with the MSVC DLL runtime, it will >> work correctly because all allocations are physically performed >> inside the (single instance of the) runtime DLL. > > I don't think this is true. Its not a matter of what runtime you use, > its a matter of where you perform the allocation. We used the DLL > runtime and had the exact same sort of issue reported by the original > poster. Putting the deallocation inside the DLL via a helper function > fixed the problem. However, the specifics are a fuzzy memory at this > point. The one thing I remembered was that allocations performed by > DLL code are allocated from a distinct heap. It has to be this way > for the memory dynamically allocated by a DLL to survive the death of > your process. Javier Arevalo Pyro Studios |