POV-Ray : Newsgroups : povray.off-topic : Linking : Re: Linking Server Time
1 Jul 2024 02:19:21 EDT (-0400)
  Re: Linking  
From: Warp
Date: 29 May 2016 01:37:52
Message: <574a8030@news.povray.org>
Orchid Win7 v1 <voi### [at] devnull> wrote:
> Presumably the object file contains some metadata too. Stuff that tells 
> you it *is* an object file, what the target processor is, what symbols 
> it exposes publicly, etc. But I'm not sure how unresolved function calls 
> are implemented.

Even the final executable file isn't a fixed blob of machine code.
Linking happens also when executing such an executble file (look up
"dynamic linker").

Executable files contain references to dynamically loadable libraries,
and when you execute such a file, the OS will insert function calls
into said executable to point to whichever dynamically loadable library
it needs (which the OS also loads or, most usually, is already loaded
into memory because most of everything else needs it too.)

The idea with dynamically loadable libraries is, of course, to save
memory and increase efficiency. Since 99.9% of all executables use
the same system functions, it's more efficient to have them all share
the one and same library in memory than to statically link all those
megabytes of system library code into every single executable.

When object files refer to other object files, or to statically linked
libraries, a similar process happens, but at linking time, rather than
at runtime.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.