[Lazarus] "Running" a library
juha.manninen62 at gmail.com
Sat Sep 15 09:40:38 CEST 2012
On Sat, Sep 15, 2012 at 12:47 AM, Mark Morgan Lloyd
<markMLl.lazarus at telemetry.co.uk> wrote:
> /Why/ can't a library be run standalone? We're already at the position that
> an executable can decide whether it's been invoked from a shell or the GUI
> and behave as appropriate, so why can't it decide whether it's being run as
> a program or being initialised as a library?
Ok, true, the compiler COULD support it but currently it does not.
>> Once it works well then you can make a dynamic library, but it still
>> needs some extra testing.
>> For example dynamic strings cannot be used across the calls,
> Works here, subject to explicit use of cmem.
IIRC the published API from a shared library cannot use normal dynamic
pascal strings. You must use PChar.
>> GUI component usage is limited etc.
> Works here as far as I've tested (i.e. merging menus from a shared library
> into the main program, using dialog(ue)s defined in the shared library and
> so on).
I have not put GUI components into libraries myself but there are bug
reports that show problems.
> Ehm... FPC can't create static libraries... anymore :)
Is it so? I forgot that but linking with compiled unit files is almost
the same thing.
Now suppose the compiler could create a library which can be run as a program.
What is a benefit compared to a separate program using the same code?
There will be 2 binaries but for testing purposes that is OK.
In any case you must also test the final shared library as a library
before sending it to users.
More information about the Lazarus