[fpc-pascal] [semi-off-topic] some C questions arising while using h2pas
Mark Morgan Lloyd
markMLl.fpc-pascal at telemetry.co.uk
Fri Jul 15 14:40:09 CEST 2011
Jonas Maebe wrote:
> On 15 Jul 2011, at 13:43, Bernd wrote:
>> To get used to this entire thing I am beginning with something much
>> more simple, I will try to get some sha hashing functions from openssl
>> imported (I will also need them, so it would not hurt to start with
> FPC comes with translated openssl headers, so other than for learning purposes you shouldn't have to do this.
>> Now the question
>> (and I am intentionally asking this on a Pascal list and not a C list
>> to get an answer that better fits into my Pascal brain) how would the
>> C compiler or linker know from where exactly to import these
> On Unix-like systems, at static link time (i.e., at the end of compiling the program), the linker searches all libraries specified on the command line for the used symbols. If a symbol is not found, you get an error. Furthermore, at run time the dynamic linker again will search for those same symbols. Depending on the operating system and the dynamic linker settings, it will only search for those symbols in certain libraries or again in any library that's in the (dynamic) library path. The binary generally does not contain information about from which library a particular symbol comes (exceptions are Windows, and at least also Mac OS X to some extent).
> http://blogs.embarcadero.com/eboling/2010/02/16/5656/ contains a fairly good overview of the symbol binding strategies on different platforms.
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
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