On Thursday 17 August 2017 10:54:31 Graeme Geldenhuys wrote:
> On 2017-08-17 07:18, Martin Schreiber wrote:
> > I don't understand why FPC uses the version-less library
> > names instead of the mayor version names where the bindings are made for.
> > Maybe a misunderstanding happened at ancient times...
> No, they are simply following the guidelines of Unix-type systems -
> doing everything correctly by the book.

A hypothetical example:

- You make a pascal bindings file for the "greatlibrary" version 1.0.
- You set the library name in the bindings pascal file "great.pas" to "great" 
as Unix-type systems guidelines command.
- In your system great-devel package of the version 1.0.1 is installed, you 
have the c-header *.h files of libgreat 1.0.1 and the links libgreat.so -> 
libgreat.so.1 -> libgreat.so.1.0.1.
- The SONAME of libgreat.so.1.0.1 is libgreat.so.1
- You compile and run the application, libgreat.so.1 -> libgreat.so.1.0.1 is 
loaded, all is OK.

Now you give the source of the application to a colleague who has installed 
the newer but incompatible "greatlibrary" version 2.0.3 including the devel 
- He has the c-header *.h files of libgreat 2.0.3 and links libgreat.so -> 
libgreat.so.2 -> libgreat.so.2.0.3.
- The SONAME of libgreat.so.2.0.3 is libgreat.so.2
- He compiles your program, the linker links libgreat.so -> libgreat.so.2 -> 
libgreat.so.2.0.3 and stores the SONAME libgreat.so.2 (remember, 
libgreat.so.2 and libgreat.so.1 are *not* compatible).

Now there are two possibilities, maybe the function names in libgreat.pas did 
not change between version 1 and 2 -> the program compiles but crashes 
because of changed parameters or other incompatibilities.
Or it does not compile and then he needs to install version 1 
of "greatlibrary" and deinstall great-devel-2.0.3 and install 
great-devel-1.0.1 or change manually libgreat.so -> libgreat.so.2 to 
libgreat.so -> libgreat.so.1 temporarily.
This also must be done in first case in order to produce a working 

The difference between a FPC bindings unit and a Unix C-header *.h file is 
that the *.h file is *included* in the devel-package and thus matches the 
installed version, the pascal file is not included but in a separate package 
or more likely taken from the FPC tar archive by the FPC install script 
because FPC Linux/FreeBSD-packages usually are too old or one wants to use a 
FPC version from SVN.
So the "guidelines for Unix-type systems" are not appropriate for Free Pascal 
C-library binding units IMHO.


Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
mseide-msegui-talk mailing list

Reply via email to