Mailing List Archive

Support open source code!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tlug: About libraries

tlug note from "Andrew S. Howell" <>
>>>>> "Chistophe" == Chistophe Gimenez <> writes:

    Chistophe> --------------------------------------------------------
    Chistophe> tlug note from "Chistophe Gimenez"
    Chistophe> <>
    Chistophe> --------------------------------------------------------

    Chistophe> Thanks you for your answer !

Your welcome.

    >> The .a libraries are used when you statically link your
    >> application. This means that all the code you need to run you
    >> application is included in the application.
    >> The .so files are shared libraries. Applications linked against
    >> these do not need to include the contents of the library in the
    >> program, just the name of the library. This makes the program
    >> much smaller. Since many programs can use the same .so, the
    >> system can make better use of memory.

    Chistophe> Another question : if the .a files are static libs, it
    Chistophe> means that they are only used when I compile a source
    Chistophe> code no ? Thus, I could delete these files since I
    Chistophe> never tell the linker to use static libs (as far as I
    Chistophe> know...) ?

Yes, You should be able to "delete" the static (.a) libs IF you have a
corresponding .so. Better to move the .a files, just in case...

    Chistophe> for example, when I use -lmsql option does it means
    Chistophe> static or dynamic linkage ?

If the linker finds, then it will link aganst
that. Failing that, it will look for msql.a. It looks for these in
either "standard" places, ie /lib /usr/lib, and in the paths specified
in the -L options passed to the linker.

When you link, you can specify which to use. From the gcc info:

     On systems that support dynamic linking, this prevents linking
     with the shared libraries.  On other systems, this option has no

     Produce a shared object which can then be linked with other
     objects to form an executable.  Only a few systems support this

    Chistophe> I'm using the Linux FT distribution. It's a good one
    Chistophe> since I've set up a Web server from trash and I have
    Chistophe> very little problems with it.  I've upgraded from 1.2.x
    Chistophe> to 2.0.27 without problems but more I use it and more I
    Chistophe> find that there are a lot of directories whose meaning
    Chistophe> is sometimes really unclear !  for example I've found
    Chistophe> the .a files to be in /usr/pkg/gcc/lib and the .so in
    Chistophe> /usr/lib or /lib. Not really easy to manage when to
    Chistophe> upgrade GNU C and/or you upgrade the libs. I think that
    Chistophe> I must have incorrect version numbers for the .a files.
    Chistophe> Thus I would like to know what is the "correct"
    Chistophe> directories structure ? I only know the one of Linux FT
    Chistophe> but is it a good one ?

I'm not familiar with the Linux FT. My guess is that the have put
applications into "packages", in a similar manner to what RedHat
does. They would have compiled GCC to look in particular places for
its libs, ie /usr/pkg/gcc/lib. I'm not sure what to suggest here as
far as "standard" directory structures. There is a linux standard
directory structure, but I've forgotten both the name and a URL I had
for it. I'll check at home. Maybe someone else here knows...

GCC is designed so that you can have multiple versions of the compiler
installed at one time. I'm not so sure about libraries....

    Chistophe> ah ! really hard to explain in English !

Don't worry. It all made sense to me!

a word from the sponsor will appear below
The TLUG mailing list is proudly sponsored by TWICS - Japan's First
Public-Access Internet System.  Now offering 20,000 yen/year flat
rate Internet access with no time charges.  Full line of corporate
Internet and intranet products are available.
Tel: 03-3351-5977   Fax: 03-3353-6096

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links