Linking and run-time libraries in Unix

Linking and run-time libraries in Unix

Post by John Pennifol » Sat, 18 Sep 1999 04:00:00



When I 'make' a program under Unix and it loads libraries (e.g. libnsl.a),
do these libraries contain all the code necessary for execution or is there
some interaction with the kernel at run-time? If I try to run the executable
on a different version of the Operating System, what is it that knows that
certain packet structures have changed (thus giving an error)?
 
 
 

Linking and run-time libraries in Unix

Post by Noby M. Josep » Sat, 18 Sep 1999 04:00:00


Hi,
     When you run this program make it does mainly these steps 1)pre-processing
2)
     compiling ,linking and then making the executable..So all there will be
libraries like static libraries and dynamic libraries which comes into picture
before making an executable..These libraries are used to understand and supply
functions that u have defined in your program.
                                The 'ld' program is the linker which links all
your .objects and the libraries and thus making an executable...So there will be
a file format in which these binaries are made..This u can see if u give the
command 'file <file-name>
So it is bound to that architecture thats why binaries are not compatible but
there are optionss u can set while u make the executable to move from one
version of OS to another or across unix platforms too...Basically u have to
understand the ELF format and the COFF format.
Hope u got some idea about this
Thanks
Noby

> When I 'make' a program under Unix and it loads libraries (e.g. libnsl.a),
> do these libraries contain all the code necessary for execution or is there
> some interaction with the kernel at run-time? If I try to run the executable
> on a different version of the Operating System, what is it that knows that
> certain packet structures have changed (thus giving an error)?


 
 
 

Linking and run-time libraries in Unix

Post by Dr. Wolfgang Otrebsk » Thu, 07 Oct 1999 04:00:00



> Hi,
>      When you run this program make it does mainly these steps 1)pre-processing
> 2)
>      compiling ,linking and then making the executable..So all there will be
> libraries like static libraries and dynamic libraries which comes into picture
> before making an executable..These libraries are used to understand and supply
> functions that u have defined in your program.
>                                 The 'ld' program is the linker which links all
> your .objects and the libraries and thus making an executable...So there will be
> a file format in which these binaries are made..This u can see if u give the
> command 'file <file-name>
> So it is bound to that architecture thats why binaries are not compatible but
> there are optionss u can set while u make the executable to move from one
> version of OS to another or across unix platforms too...Basically u have to
> understand the ELF format and the COFF format.
> Hope u got some idea about this
> Thanks
> Noby


> > When I 'make' a program under Unix and it loads libraries (e.g. libnsl.a),
> > do these libraries contain all the code necessary for execution or is there
> > some interaction with the kernel at run-time? If I try to run the executable
> > on a different version of the Operating System, what is it that knows that
> > certain packet structures have changed (thus giving an error)?

... lots of useful info, but one or the other info still missing
without the possibility of giving exhaustive info here, I'll try to
help a bit more: Yes, there is interaction with the kernel code.
Every process has to invoke kernel code for various tasks as e.g. I/O
Sometimes kernel code gets invoked while a user process is happily
executing
its own code. Ah, there comes an interrupt! The clock ticked. Now let's
see
what has to be done - increment this, do that, check the time slice of
the
running process, check for "whole second", if yes, do some more...
If the process is allowed to continue we return from interrupt, else
we invoke the scheduler to put the next in line onproc...
The entry points into kernel code are closely guarded. A process enters
kernel code through a piece of code that has to be flawless and checks
eerything connected with the process' request, then dispatches to the
appropriate subroutine to service that request - or to deny such
service.
there's a lot more to it, you should get a look into the Linux Kernel
Hackers Guide and into the Linux kernel sources. Other reading of
interest
(maybe you go into a library): Maurice J. Bach (Author's name is
correct)
The Design of the UNIX Operating System (or so), a bit outdated but
still
good reading matter. McKusick, Leffler, Karels, Quarterman (spelling?)
Design and Implementation of the BSD 4.3 ... ("Teufelchenbuch") gives
deep insight. The Magic Garden Explained ("Eine Reise durch den
Zaubergarten")
gives lots of details about SVR4...

giving an error... hmmm... Shared libraries have a version number and if
that
number is wrong - out of luck. Executables have a "magic number" checked
by
the exec code, sometimes that helps to avoid the worst. In most cases
the
interface to kernel code remains unchanged over a long range of system
versions, thus giving binary compatibility.

email me if you want to learn more...
HTH, wolfgang
--
Standard disclaimer applies (anyone following advice given here does so
at her/his own risk - I speak for myself and not for my employer).

 
 
 

Linking and run-time libraries in Unix

Post by voi » Thu, 07 Oct 1999 04:00:00



>McKusick, Leffler, Karels, Quarterman (spelling?)
>Design and Implementation of the BSD 4.3 ... ("Teufelchenbuch") gives
>deep insight.

However, you might find that _The Design and Implementation of the
4.4BSD Operating System_ is a bit more current.

--
 Ben

[X] YES! I'm a brain-damaged lemur on crack, and I'd like to
    order your software package for $459.95!

 
 
 

Linking and run-time libraries in Unix

Post by Dr. Wolfgang Otrebsk » Tue, 12 Oct 1999 04:00:00




> >McKusick, Leffler, Karels, Quarterman (spelling?)
> >Design and Implementation of the BSD 4.3 ... ("Teufelchenbuch") gives
> >deep insight.

> However, you might find that _The Design and Implementation of the
> 4.4BSD Operating System_ is a bit more current.

> --
>  Ben

> [X] YES! I'm a brain-damaged lemur on crack, and I'd like to
>     order your software package for $459.95!

You're right! sorry for the outdated info / typo... It's been 4.3 for so
long a time that my fingers still type 4.3....

wolfgang
--
Standard disclaimer applies (anyone following advice given here does so
at her/his own risk - I speak for myself and not for my employer).

 
 
 

1. Run-time library for c-compiled code on UNIX

I want to be able to include a library at run time instead of compile.  
The UNIX Xwindow system has done this.  We are running CLIX 3.1 and using
th apogee c compiler.

Process:
   compile code with referneces to the run-time libraries
   deliver the run-time libraries with the product on purchase
      purchases would allow different version of libraries

That's the overview of the purpose of this post,

Thanks for your help

Randy Harbison

2. vm86() - can someone point me in the right direction?

3. Need help with 'time' C Run-Time Library functions under HP-UX

4. Audio CD problems

5. Unix Libraries Ins/Outs

6. killing CGI process (imagemap) 1.3R, UW

7. run-time library "can't open file" error

8. removing shared memory

9. Removing indirect run-time link dependencies.

10. Loading libraries run-time: dlopen, dlsym, dlclose

11. Couldn't find run-time library.

12. run-time link order affects Applications?

13. looking for fortran run-time libraries for solaris