[Lazarus] "Running" a library

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Sat Sep 15 10:52:10 CEST 2012


Juha Manninen wrote:

>>> 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.

I'm definitely passing strings between a .so and main program, both 
written using Lazarus. So e.g. a frontend program can call these from 
the backend:

function LoadConfiguration(base: string= ''): boolean;
function BackendAboutText: string;

and the backend can call these from the fontend:

procedure FrontendSetButtonLegendSafe(index: integer; const legend: string);
procedure FrontendOutputWriteSafe(const str: unicodestring; fg: TColor= 
clBlack; bg: TColor= clDefault);

>>> 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 need to correct an inaccuracy: I should have said displaying 
messageboxes rather than using dialog(ue)s.

> 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

Noted, and obviously I defer to your experience and direct involvement. 
But it is possible to define the structure of displayable objects in a 
shared library, and then to copy them when needed.

-- 
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