Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jan 1999 21:45:26 +0000
From:      Nik Clayton <nik@nothing-going-on.demon.co.uk>
To:        "Michael A. Endsley" <al7oj@customcpu.com>
Cc:        Freebsd-newbies@FreeBSD.ORG
Subject:   Re: statically/dynamically based software
Message-ID:  <19990128214526.A11914@catkin.nothing-going-on.org>
In-Reply-To: <3.0.5.32.19990127141601.007edc40@customcpu.com>; from Michael A. Endsley on Wed, Jan 27, 1999 at 02:16:01PM -0900
References:  <3.0.5.32.19990127141601.007edc40@customcpu.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 27, 1999 at 02:16:01PM -0900, Michael A. Endsley wrote:
> Can some one tell me the difference between these 2 items?
> I want to download software, but the pages list for either of the 2.
> I am running FreeBSD 3.0-R as just a home user.

It's all to do with libraries.

When you load and run a "dynamic" program, the binary file doesn't contain
the whole of your program. Instead, it references libraries that contain
common routines. For example, "libc" contains most of the library of code
for standard C functions like printf().

If every program had to carry the code for printf() (and all the other
functions around) then they'd all be much larger.

Instead, when your program runs it is "dynamically linked" with the 
correct libraries.

However, what if you're building a program, and you don't know for certain
that the right libraries will be available on the system it will run on?
Or you don't know that the version of the libraries on the target system
is correct?

In this case, you can choose to link your program statically. If you do
this then all the code from the libraries that your program uses is
bundled in to the executable file, giving you a complete, standalone
binary that pretty much anyone can execute. This file is somewhat bigger
than a dynamically linked one, because it contains all the extra code.

With your RealPlayer example -- it was probably compiled on a FreeBSD
-stable system (or possibly a direct release). However, people downloading
it might run it on a variety of different FreeBSD releases, and some of 
those releases (-current in particular) will have different libraries, and
some of the library functions might have changed as well.

Instead of providing lots of different binaries, and saying "Download 'x'
if you're running -stable, 'y' if you're running 2.2.7, 'z' if you're 
running -current before 15th January 1999, and 'foo' if you're running
-current after 15th January 1999" they provide one, statically linked
binary that should run pretty much anywhere.

Make sense?

N
-- 
                    Bagel: The carbohydrate with the hole

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-newbies" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990128214526.A11914>