[fpc-devel] Access Violation with nested DLL's compiled by FPC(andsome more info on bug #4538)

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Dec 10 23:03:59 CET 2005

On 10 Dec 2005, at 22:55, L505 wrote:

> The DLL does not know what your EXE memory is doing. So by the time  
> the string gets
> to the DLL it may be cleaned up and gone, kind of like a garbage  
> collector. Same
> thing with returning a string..

This does not make sense to me. When you return a string (from a  
function in a dll or anywhere else), this string will have a  
reference count of at least 1 and thus will not be cleaned up by anyone.

The only problem I can see that can occur is in case the program and  
the dll indeed use different memory managers, in which case you can  
have a situation where memory allocated by the dll's memory manager  
is freed "to" the program's memory manager, and that will probably  
confuse the hell out of it (even if they are essentially the same  
memory manager, just using different data structures).


More information about the fpc-devel mailing list