[fpc-pascal] Reproducible code: DLL calling Firebird crashes

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Tue Sep 30 22:17:59 CEST 2014


Sven Barth wrote:

> The only other alternative would be to add the RTL initialization code 
> to each exported function. I don't consider this a viable alternative.

Which is more or less what Reinier's working code did. I'd hate that to 
be an implicit default.

> Note: Dynamic packages won't have this problem, because:
> - for packages linked at compile time the initialization is run as part 
> of the program initialization AFTER the OS has initialized the library 
> (which doesn't do much in case of a package)
> - for packages loaded at runtime it's done as part of the LoadPackage call
> That's however only possible, because dynamic packages are very 
> different from simple libraries (and stuffed with compiler magic).

Is it possible for code in a unit to determine what sort of project it's 
part of, i.e. a standalone program, a library etc.? Could the RTL have a 
flag indicating that initialisation (or finalisation?) blocks were 
currently being run, and anything called should assume that facilities 
were restricted?

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