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

Marc Weustink marc at dommelstein.net
Fri Dec 9 19:49:03 CET 2005


Jonas Maebe wrote:
> 
> On 9 dec 2005, at 16:03, Marc Weustink wrote:
> 
>> Before we can say something, what functions do you call, what  params, 
>> what calling convention etc.
>> Does it happen in one specific sequence of calls, to specific  
>> functions/methods etc.
>>
>> Please provide some more info.
> 
> 
> http://www.freepascal.org/bugs/showsource.php3?ID=4538

Whoops, I didn't saw that there was a bugrep.

I'm not shure if FPC behaves the same as Delphi, but I think it does.

In Delphi you cannot exchange ansistrings between dlls, unless you have 
a shared memory manager. Normally each exe (or dll) has its own memory 
manager. So when you pass a string to a dll and it it goes out of scope 
there (since it is changed) it is released there. So a allocated memory 
block from one manager is freed in another. This gives all kinds of 
unexpected errors at strange places.

IIRC the way constant strings are allocates it changed, so that may be 
the reason that you didn't see the error on dlls generated by an older fpc.

Marc




More information about the fpc-devel mailing list