Am 20.09.2015 07:03 schrieb "Bo Berglund" <[email protected]>: > > 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?
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 ;) ). Things to keep in mind though: - declare exported functions as "cdecl" - WideString is - unlike on Windows - not cross-library-safe - and of course the usual points regarding strings, objects, etc. apply Regards, Sven
-- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
