When exactly does a DLL use a different heap than an executable?

I know that if your static DLL links are against a different version of the runtime, then it creates its own heap. It will also be if he is tasked with making a bunch. In these circumstances, it is not safe for a DLL to delete what is allocated by exe. In what cases does this NOT apply (for example, is it safe to delete a DLL that is allocated by exe)? Is it safe that both exe and the static link DLL for the same runtime library?

thank

Basically, there is a way so that the one who allocated it could just do addEvent(new DerivedEvent(), FunctorDestroyClass());

+5
source share
2 answers

, , , , DLL, - :

#define DLLMemAlloc( size ) HeapAlloc( GetProcessHeap(), 0, size )
#define DLLMemFree( mem )   HeapFree( GetProcessHeap(), 0, mem )

( ). , , .

( ), , . , , DLL , DLL ( ).

+2

DLL , . 3 : , ( DLL, , ), , .

0

All Articles