[fpc-devel] Access Violation withnested DLL'scompiledbyFPC(andsomemore info on bug #4538)

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Dec 16 15:03:11 CET 2005


On 16 dec 2005, at 12:06, L505 wrote:

> I'm still
> running it through my head to really understand it on a deeper  
> level with the DLL
> situation, though - since that's what this thread is trying to  
> solve in the end.

Other people have already said it is what I suspected: each DLL has  
its own memory manager structures apparently, and that means that  
memory allocated by one memory manager can be released to another,  
which results in very bad things.

> The other problem I see with Marc's diagram was that somehow you  
> showed the string
> being decremented before anything even happened. Shouldn't it  
> decrement after something
> happens, such as in Jonas' example?

In my example there is also a decrease "before anything even  
happened". If you have

s := t

then the reference count of the ansistring s points to is decreased  
before the assignment is carried out (because the compiler inserts a  
call to a routine that does this decreasing), because after you have  
overwritten s you obviously don't know anymore what it pointed to.


Jonas




More information about the fpc-devel mailing list