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

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Fri Sep 26 17:06:37 CEST 2014

Reinier Olislagers wrote:
> DLL creation newbie here; Windows; x86 FPC trunk.
> Going with the FPC programmer's guide, I wrote a DLL that looks up
> address data in a Firebird embedded db.
> Managed to get a console demo calling it running but:
> 1. It is slow to show output: no output for a while before showing the
> results of the address data calls to the dll.
> 2. It is slow to close as well. It hangs for a while and then Windows
> pops up a dialgo "dlldemo.exe has stopped working" etc.
> Firebird embedded log says it closed the connection while a user was
> connected, so I suspect my db code.
> Problem is, it works ok in my GUI code that uses units (no dlls).
> gdb dpesn't seem to show anything special.
> https://bitbucket.org/reiniero/postcode/src
> DLL source code: Source/dutchpostcode.lpr
> Demo program: Source/dlldemo.lpr
> Anything special/obvious I need to do?
> Enable multithreading? C memory manager?
> (FPC had a problem with Firebird embedded 2.5.3 but that was with
> client/server, not embedded+that has been fixed meanwhile)
> Advice (and requests on specific further info) welcome before I start
> wildly throwing switches?

For Linux, cmem before HeapTrc before cthreads before Classes etc., in 
both main program and DLL. Otherwise play with String[255] etc.

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