[fpc-pascal] DLL calling Firebird: slow and crashes at the end
Reinier Olislagers
reinierolislagers at gmail.com
Fri Sep 26 17:26:05 CEST 2014
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).
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 ;)uses
Classes, businesslogic, postcodebulkcorrect, postcodedb, dutchaddress;
var
Address: TDutchAddress;
Business: TPostcodeBusiness;
...
function Address2Postcode(): PChar; {$IFDEF
MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
....
function CheckCitySpelling(City: PChar): boolean; {$IFDEF
MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
...
exports
Address2Postcode,
CheckCitySpelling,
...etc...
ValidateAddress;
{$R *.res}
begin
// Set up objects for use by our functions
Address:=TDutchAddress.Create;
Business:=TPostcodeBusiness.Create;
try
// nothing here
finally
Address.Free;
Business.Free;
end;
end.
More information about the fpc-pascal
mailing list