[fpc-pascal] Reproducible code: DLL calling Firebird crashes

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Thu Oct 2 12:19:29 CEST 2014


Reinier Olislagers wrote:
> On 30/09/2014 22:05, Mark Morgan Lloyd wrote:
>> Marco van de Voort wrote:
>>> In our previous episode, Sven Barth said:
>>>> It is indeed true that all units are initialized once the main code
>> Reinier: did you get as far as looking in Dynlibs for an error message
>> immediately after trying to connect to the database?
> 
> No, I didn't.

Assuming you've got >= 2.6.2, modify your code to look like this:

uses DynLibs;
..
   WriteLn('Before TDBInterface.Create(): ', GetLoadErrorStr);
   DBLayer:=TDBInterface.Create;
   WriteLn('After TDBInterface.Create(): ', GetLoadErrorStr);

On Linux, I can see it calling the database connection stuff but then it 
raises an exception because it can't find the named server etc. So at 
least on Linux it's apparently transferring control into the 
demand-loaded database stuff, since otherwise there wouldn't be the 
messages as shown below. Whether it's appropriate and portable to do it 
like that is a different issue.

I don't want to have to spend time changing your test code to suit 
PostgreSQL or digging out names etc. for the limited number of Firebird 
databases I've got set up, and I /really/ don't want to start fiddling 
with Windows.

Before TDBInterface.Create():
An unhandled exception occurred at $B767EFEF :
EIBDatabaseError :  : DoInternalConnect :
  -Unable to complete network request to host "firebirdserver".
  -Failed to locate host machine.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list