Delphi, Free Pascal, and Lazarus

Delphi, Free Pascal, and Lazarus

The Delphi API is among the first Yoctopuce libraries that we published. A few years later, someone asked us to make it also compatible with Lazarus, which we did gladly, but without advertising it. Recently, we were asked if we couldn't make it so that the library works with the Linux version of Lazarus as well.





To be completely honest, we were quite unaware of the existence of a Linux version of Lazarus, this IDE based on Free-Pascal. After a few trials and errors, we managed to modify the Delphi API so that it compiles with Lazarus under both Linux and Windows, while remaining compatible with Delphi, including its version 5 which dates back from 1999! At Yoctopuce, we really like the backward compatibility concept :-)

For the API to work under Linux, you need the following libraries, which are now available in the Delphi archive:

  • libyapi-i386.so for 32-bit Intel systems
  • libyapi-amd64.so for 64-bit Intel systems
  • libyapi-armhf.so for 32-bit ARM systems
  • libyapi-aarch64.so for 64-bit ARM systems


To compile and run without trouble your programs written with Linux Lazarus, you must make sure that:

  • Lazarus can locate the correct .so file at compilation time
  • The executable file can locate it execution time


For this, you have two options: the traditional solution consists in copying the files once and for all in the /usr/lib directory. If you can't do that or if you simply want to make a test, you can copy them in the same directory as your source code and add the current directory to your LD_LIBRARY_PATH environment variable, with the following command:

export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH


For Delphi and Windows Lazarus, nothing changed, you must make sure that the yapi.dll (32bit) and yapi64.dll (64bits) are available at runtime. The simplest solution is to put them in the same directory as your executable file.

To make life a little easier for Lazarus users, we adapted the basic examples of the Yoctopuce library so that you can now open them directly with this IDE.

Here you go, that's it for this week.

Add a comment No comment yet Back to blog












Yoctopuce, get your stuff connected.