[Lazarus] Equivalent of a Windows DLL on RPi?

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Sun Sep 20 10:05:51 CEST 2015

Bo Berglund wrote:
> I am investigating programming for the Raspberry Pi as described in my
> other thread. Could someone please outline if there is a concept like
> a Windows DLL also in Raspbian for the Pi?
> I have a DLL written in Delphi7 (or 2007), which implements a whole
> bunch of basic functions and I am wondering if a similar file as a DLL
> is used in Linux. If so could I port the existing DLL from Windows to
> freepascal and then to Linux on the Pi?
> I got some advice on the porting process in my other thread but in
> this case it involves the creation of a DLL equivalent so that the
> main programming could be done in for example Python while using the
> functions from the DLL code?

It's a .so file. I think Lazarus has the same restrictions for both 
Windows and unix: by default, there's a separate heap in the main 
executable and in each separately-linked .so library which means that 
you can't pass anything dynamically-allocated (strings, objects etc.) as 
parameters or (in particular) return them as results. The way round this 
is to use this at the start of each .lpr:

   cmem, { HeapTrc, } Classes, interfaces
   { you can add units after this }

Then in the library .lpr you have an exports list for entry points.

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