On Sat, Sep 15, 2012 at 12:47 AM, Mark Morgan Lloyd <markmll.laza...@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. http://bugs.freepascal.org/view.php?id=18624 http://bugs.freepascal.org/view.php?id=15126 http://bugs.freepascal.org/view.php?id=7181 http://bugs.freepascal.org/view.php?id=7182 http://bugs.freepascal.org/view.php?id=1866 >From leledumbo: > 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. Regards, Juha -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus