<p>Am 20.09.2015 07:03 schrieb "Bo Berglund" <<a href="mailto:bo.berglund@gmail.com">bo.berglund@gmail.com</a>>:<br>
><br>
> I am investigating programming for the Raspberry Pi as described in my<br>
> other thread. Could someone please outline if there is a concept like<br>
> a Windows DLL also in Raspbian for the Pi?<br>
><br>
> I have a DLL written in Delphi7 (or 2007), which implements a whole<br>
> bunch of basic functions and I am wondering if a similar file as a DLL<br>
> is used in Linux. If so could I port the existing DLL from Windows to<br>
> freepascal and then to Linux on the Pi?<br>
><br>
> I got some advice on the porting process in my other thread but in<br>
> this case it involves the creation of a DLL equivalent so that the<br>
> main programming could be done in for example Python while using the<br>
> functions from the DLL code?</p>
<p>As the RPi uses a Linux (at least in normal cases) it also supports shared libraries. They are written in FPC the same way as they are in Delphi (by having a "library xyz" main file with an "exports" clause). This will result in a ".so" file that you can load in FPC using the DynLibs unit with LoadModule() and GetProcAddress() and in C-based languages using dlopen()/dlsym() (don't know what Python uses, but I bet it's the same across platforms ;) ).<br>
Things to keep in mind though:<br>
- declare exported functions as "cdecl"<br>
- WideString is - unlike on Windows - not cross-library-safe<br>
- and of course the usual points regarding strings, objects, etc. apply</p>
<p>Regards,<br>
Sven</p>