[Lazarus] "Running" a library
Mark Morgan Lloyd
markMLl.lazarus at telemetry.co.uk
Sat Sep 15 14:32:43 CEST 2012
Sven Barth wrote:
>>>> You are able to define exports from a program. And you can also load
>>>> the program binary using LoadLibrary from a library that is already
>>>> loaded from that program (because the entry point is not called then),
>>>
>>> I'm already calling from a loaded library back into the calling program
>>> using that technique. What happens if a library tries to load a
>>> /different/ program: is the main entry point called and are the
>>> subsidiary entry points available?
>>>
>>
>> I currently only have one answer for that: try it and see what happens.
>
> I have now checked ReactOS' code: if you load an exe that is not the
> main executable then the entry point won't be called at all. So it seems
> that you can load such executables and call functions from them, but in
> the case of FPC you might be screwed (or at least very restricted) as
> the initialization sections of the units won't be run (this includes the
> system unit which initializes the heap, io, etc.).
Thanks for that, I'm currently looking at the situation on x86 Linux
since I think it's worth progressing this while the thread's fresh.
The fact that the heap etc. wouldn't be initialised had already occurred
to me. Is there any way to fake this?
--
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 Lazarus
mailing list