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

Stefan van den Berg stefan at iquad.nl
Thu Dec 8 10:23:18 CET 2005


Hi,

I've already asked about this on the community forums on the 
freepascal.org site and opened a bug on the bugtracker (bugID #4538). 
But none of those show any progress on a solution to the problem I'm having.

First a little backstory: I'm currently, as part of an internship, 
porting an application written in Delphi 6 to Free Pascal/Lazarus. The 
application consists of a main executable and a bunch of (23, to be 
exact) DLL's. The app uses some of these DLL's and some other are used 
by the DLL's themselves. To make this more clear, I've schematically 
illustrated the situation below.

             Main-app
             /  |  \
        dll2-   |   --dll1
        /       |       \
   dll3-       dll3      -dll2
                            \
                             -dll3

Dll3 could, for example, be a library which is responsible for logging 
(debug)messages to a file on disk.

Right now I've come to the point where every individual part seems to do 
what it should do. But when testing the whole package, I came across a 
problem, which at first i thought to be a bug in our code. But after 
some debugging and after testing with a bunch of simple testcases I 
concluded that my problem might be caused by a bug in FPC itself.

The problem is this: When the app calls a function in dll1, which calls 
a function in dll2, which calls a function in dll3, an AccessViolation 
is thrown when calling the function in dll3.

This problem is blocking further porting efforts, So you can guess that 
I'd really like to see this resolved.

What I'd like to ask is, am I doing something wrong? If so, what is it 
I'm doing wrong? If not, can anybody confirm the bug (if there is one) 
and maybe give a possible ETA for a fix.

FPC versions I've confirmed the problem with are:
official win32 2.0.0 binaries: Access violation when calling a function 
in dll3 from dll2 from dll1 from app
home-brew 2.0.3 (built on 6 dec) in win32: AV when calling function in 
dll3 from dll2 from dll1 from app
2.1.1 bundled with Lazarus nightly build (6 dec ): AV when calling dll2 
from dll1 from app.

I'm the one who submitted bug #4538. At that time I thought the problem 
only occurred on win32 when using fpc 2.1.1, because I only tested with 
2 levels of dll's. When I ran into the access violation problem again 
(with a dll 'tree' of at least 3 levels deep) on Linux using fpc 2.1.1 
and 2.0.3, i concluded that probably all the 2.x versions suffer from 
somewhat the same problem.

Regards,
Stefan van den Berg



More information about the fpc-devel mailing list