[fpc-pascal] Reproducible code: DLL calling Firebird crashes
Sven Barth
pascaldragon at googlemail.com
Wed Oct 1 07:21:38 CEST 2014
Am 30.09.2014 22:19 schrieb "Mark Morgan Lloyd" <
markMLl.fpc-pascal at telemetry.co.uk>:
>
> 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?
Isn't there a IsLibrary variable in System? For sure there is a IsPackage
variable which will be true if the unit is part of a package (though I
still need to find out how to implement this).
You don't need a flag for initialization/finalization blocks, because if
your code resides in one then you are obviously run inside one...
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20141001/d3ee0050/attachment.html>
More information about the fpc-pascal
mailing list