[fpc-pascal] DLL calling Firebird 2: crashes at the end

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Sun Sep 28 11:30:08 CEST 2014

Reinier Olislagers wrote:
> After hopefully getting parameter passing fixed (I hope, thanks Mark),
> I'm still facing this problem:
> dll using Firebird crashes on Windows and Linux
> Using a dummy db unit that does not connect to Firebird: everything ok.

Can you link the lookup DLL/so statically for test purposes?

> If I add cmem first in the .so uses clause, I get this on running my
> dlldemo application:
> Inconsistency detected by ld.so: dl-minimal.c: 136: realloc: Assertion
> `ptr == alloc_last_block' failed!

If adding cmem to one you might need it in both to be effective.

> Should I enable other options?
> Longer term, I think this is a good reason to start PostgreSQL support
> and check if that works.
> Pointers/advice/requests for further info welcome, thanks.

The only thing I can add at this point is that there are a couple of 
cases where I've written code to interface to multiple databases 
(Firebird, PostgreSQL) but while the underlying database library 
(presumably written in C) might be linked dynamically I've not tried 
interposing a custom demand-loaded library... I presume that in your 
case you're leaving the OS to do the load when the program starts, but I 
think that the same points about memory managers etc. apply. I have used 
demand-loaded libraries to interface to e.g. custom processing for MIDI 
or to optionally load e.g. libpcap, and once working it's reliable.

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