[fpc-pascal] [semi-off-topic] some C questions arising while using h2pas

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Sat Jul 16 00:08:54 CEST 2011

Jonas Maebe wrote:
> On 15 Jul 2011, at 14:40, Mark Morgan Lloyd wrote:
>> I wonder if I could tack a question onto this. When I started looking at SPARC Solaris 10 and Solaris 8 earlier in the year, I found that the linker (which I think was gld) followed symlinks at build time rather than waiting until runtime. This meant that while I was able to build FPC on 10 without significant difficulty, I couldn't move the binaries back to 8: I had to rebuild with a hacked symlink to a temporary copy of one of the standard libraries (possibly libc, I can't remember for certain).
>> Is this what one would expect, or is it another ld glitch that might be platform-specific?
> It is expected. The logic is:
> a) you build the application using a certain set of headers that go with a certain version of the library. Hence, the program should be linked against that particular version of the library
> b) you don't want to have to change the build command every time a library gets updated. Hence, there is a symlink with a generic name going to the default version of the library (and on most Linux systems this symlink in fact is only created if you install the -devel version of a package, since it is only required when compiling programs)
> c) if a library changes in a way that breaks backwards compatibility as far as the api is concerned, its major version is increased so that applications built against a previous version of the library won't use the newer one and then crash. Also, since the new version has a different name, you can in principle have both the old and the new version installed concurrently so that both old apps and new apps still work (the system however breaks down when a single program uses e.g. libA and libB that in turn depend on respectively libfoo.1.so and libfoo.2.so, because both libfoos will probably have a bunch of symbols in common causing symbol resolution conflicts)

Thanks Jonas, noted and understood. To summarise, a .h corresponds to a 
very specific version of a library; if there is a symlink to that 
library it is provided as a courtesy.

Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

More information about the fpc-pascal mailing list