Apologies for my lousy message threading, but some are vanishing in the spamtrap.

>> OK, so to emphasise that: library B's data will be common,
>> irrespective of the location of the calling routine. Does this
>> apply if the load is being done at runtime, i.e. the program is
>> using dl (or whatever) to load A and B, and A also uses dl to
>> load B?
>
> It does not matter whether the library is loaded at program start
> or at runtime. It's always the same mechanism with the exception
> that in the first case your main function has not yet been called
> (which normally doesn't matter either).

Just being cautious :-) One final question if I may: noting Ludo's example elsewhere:

> In the project.lpr add the following code:
>
> Procedure qt_startup_hook;export;
> Begin
> End;
>
> Exports qt_startup_hook;

Can such an alternative entry point in the main unit be called by a shared library, i.e. either resolved at load time or with the main binary reopened like a library? Or is the only way to pass a main-program entry point to a shared library by using it as a parameter to a procedure?

I've used such things in a Windows-style .exe so a loader/binder would know how to generate absolute code for an embedded system, but have never tried exploiting it with a "real" OS.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to