Creating bindings for C libraries
From Free Pascal wiki
Jump to navigationJump to searchOverview
You have a C library (for example a .dll or .so) and you want to use it in your pascal program. You only found C header files (.h) and now you want to create one or more pascal units to access them.
FPC can easily use C libraries. For example you only need to provide for every needed function a pascal function and add the 'external' modifier.
For small libraries this can be done manually, but for big libraries with hundreds or thousands of functions, constants, types and variables you should use tools like h2pas.