[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:41:24 CEST 2014


Reinier Olislagers wrote:
> On 26/09/2014 17:06, Mark Morgan Lloyd wrote:
>> For Linux, cmem before HeapTrc before cthreads before Classes etc., in
>> both main program and DLL. Otherwise play with String[255] etc.
> 
> Thanks. Currently not using cmem or heaptrc or cthreads.
> (The "regular" GUI application using the db etc units doesn't either)
> 
> Currently trying to get my Linux VM going again (or reinstalling)...
> will test it to see if it is a Windows thing.
> 
> About the string[255] - surely you don't mean using shortstrings inside
> my regular units[1]? The DLL source code only communicates to the caller
> via doubles, booleans and pchars (could be a few more, but not strings).

I'm in the middle of kernel test builds at the moment, so forgive me if 
I'm not giving your posted example as much attention as it deserves. I 
was assuming that you'd written both the main program and the DLL, which 
would have been analogous to the program I checked (which also used the 
LCL etc.).

If using pchars: is the program doing all storage allocation for these 
or is the DLL also allocating memory?

> Snippet - unit providing Business object has a uses clause calling my db
> unit that uses initialization/finalization to set up a single DBLayer
> object per application (or per library) and close it down.
> 
> library dutchpostcode;
> ...
> 
> 
> [1] But I"m asking anyway - the world is starting to look flat here ;)

I thought Holland /was/ flat :-)  I was again thinking of the case where 
both the main program and the DLL were your code. Using shortstrings 
removes some of the dynamic allocation, hence potentially the need for a 
single memory manager (cmem).

-- 
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