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

2014-09-29 Thread Reinier Olislagers
On 28/09/2014 18:10, Michael Van Canneyt wrote: > From your story, I doubt your problems are Firebird related. Firebird > (or any other DB client lib) just uses the buffers you provide. Except that - as I mentioned - replacing my db layer calling Firebird with a dummy layer that does nothing resol

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

2014-09-29 Thread Graeme Geldenhuys
On 2014-09-28 10:32, Michael Van Canneyt wrote: > I do a lot of work with firebird embedded, and I've never even come close > to the problems you're experiencing ? +1 Using Embedded and C/Server in a few projects under Windows and Linux (unofficial support) and it works fine here too. I use FPC'

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

2014-09-28 Thread Michael Van Canneyt
On Sun, 28 Sep 2014, Reinier Olislagers wrote: On 28/09/2014 11:32, Michael Van Canneyt wrote: On Sun, 28 Sep 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 Lin

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

2014-09-28 Thread Reinier Olislagers
On 28/09/2014 14:52, Mark Morgan Lloyd wrote: > Reinier Olislagers wrote: >> On 28/09/2014 13:54, Mark Morgan Lloyd wrote: > I think the first thing I'd try is a trivial program+DLL checking that > the DLL can initialise a database library, in case there's something > wrong with multistage initiali

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

2014-09-28 Thread Mark Morgan Lloyd
Reinier Olislagers wrote: On 28/09/2014 13:54, Mark Morgan Lloyd wrote: Reinier Olislagers wrote: But when your code modifies strings in the context of the database library they're preallocated C-type strings, i.e. can't be extended or shrunk so don't make unexpected reference to any memory mana

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

2014-09-28 Thread Reinier Olislagers
On 28/09/2014 13:54, Mark Morgan Lloyd wrote: > Reinier Olislagers wrote: > But when your code modifies strings in the context of the database > library they're preallocated C-type strings, i.e. can't be extended or > shrunk so don't make unexpected reference to any memory manager. Yes, I agree. Ho

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

2014-09-28 Thread Mark Morgan Lloyd
Reinier Olislagers wrote: If the custom library never made any attempt to access Pascal-type (long) strings, dynamic arrays, or anything else on the heap which might be reallocated or extended when referenced (i.e. not just at creation), then you'd not need to do anything special. But as soon as

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

2014-09-28 Thread Reinier Olislagers
On 28/09/2014 13:02, Mark Morgan Lloyd wrote: > So in your case (2) there are three separate binaries which potentially > allocate and free memory: (i) the database library (ii) the custom > DLL/so and (iii) the application program, and in the general case each > one should free precisely those are

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

2014-09-28 Thread Mark Morgan Lloyd
Reinier Olislagers wrote: May be me, but I have trouble understanding why: 1. A regular program loading Firebird .so/.dlls works without any specified cmem etc. Here application<>Firebird dll 2. An FPC library, coded similarly to 1., fails. Here application<>dll<>Firebir dll The difference betwe

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

2014-09-28 Thread Reinier Olislagers
On 28/09/2014 11:30, Mark Morgan Lloyd wrote: > Reinier Olislagers wrote: > Can you link the lookup DLL/so statically for test purposes? I'll have a look. >> 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.

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

2014-09-28 Thread Reinier Olislagers
On 28/09/2014 11:32, Michael Van Canneyt wrote: > > > On Sun, 28 Sep 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

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

2014-09-28 Thread Michael Van Canneyt
On Sun, 28 Sep 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. Perhaps a stupid questi

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

2014-09-28 Thread Mark Morgan Lloyd
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 t

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

2014-09-28 Thread Reinier Olislagers
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. Compiler options on a Windows compile: -MObjFPC -Scaghi -WR -Cirot -Os -gw2