What is "shared library" in C, is there any small example I can see?

Discussion in 'C Programming' started by santa19992000@yahoo.com, Oct 15, 2005.

  1. Guest

    Confusing th eword with "library", "shared library" and how to use
    these things in real C project, is there any small example I can take a
    look. Thanks.
    , Oct 15, 2005
    #1
    1. Advertising

  2. In article <>,
    <> wrote:
    >Confusing th eword with "library", "shared library" and how to use
    >these things in real C project, is there any small example I can take a
    >look. Thanks.


    The C language itself does not have "library" or "shared library"
    or "project". The C standard requires that the implementation provide
    a standard set of routines which it calls "the standard library",
    but the C standard puts no restriction on how the implementation
    does that.

    It is -common- for implementations to provide ways of bundling
    groups of half-compiled programs, and that those bundles can
    be referenced by the linking phase in order to provide access
    to the routines and data, but there is a fair variability in
    how that is done.

    A "shared library" (in common parlance) is just another
    library (with system-dependant semantics and invocation
    mechanisms). Again the C standard has nothing to say on
    the matter.

    When a system bothers to distinguish between a "library"
    and a "shared library", it might commonly be saying that
    only one copy of the "shared library" will be placed in memory
    for access by all users and all processes, whereas a library
    on such a system that was -not- "shared" would have a copy of
    some or all of it placed into each process's address space.

    Details of what a "library" or "shared libary" mean on your
    system, and how to use them, should be asked about in a newsgroup
    appropriate for your system. As I mentioned before, they are not
    C concepts as such, and there are important differences between
    different systems.
    --
    Chocolate is "more than a food but less than a drug" -- RJ Huxtable
    Walter Roberson, Oct 15, 2005
    #2
    1. Advertising

  3. Malcolm Guest

    <> wrote
    > Confusing th eword with "library", "shared library" and how to use
    > these things in real C project, is there any small example I can take a
    > look. Thanks.
    >

    Most C implentations allow you to build "libraries" - compiled function
    which can be called from user code. The standard library and extensions will
    probably come with the compiler as "library" files.

    On a big system, exactly what some of these libraries do can be complex. For
    instance a sophisticated operating system won't want printf() writing pixels
    directly to the screen, it will want facilities for capturing and
    redirecting output, changing fonts, providing braile access for blind users,
    and so. Also it doesn't make any sense to load a huge system for one "hello
    world" program - better have all the code resident in memory.

    Exactly what "shared library" menas can differ, however, as Walter pointed
    out. It could mean a libary which more than one application links to, it
    could mean a library of which only one copy is in memory at any one time, it
    could mean a library like the braile printf example which several programs
    access simulataneously in a cooperative manner.
    Malcolm, Oct 15, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Flip
    Replies:
    3
    Views:
    961
    Tony Morris
    Feb 9, 2004
  2. ingres2008
    Replies:
    1
    Views:
    2,276
    Mike Wahler
    Oct 8, 2003
  3. Steve Kershaw
    Replies:
    1
    Views:
    344
    Brennan Stehling
    Sep 26, 2006
  4. Replies:
    1
    Views:
    1,257
    santosh
    Jul 15, 2008
  5. Justin Wyllie
    Replies:
    5
    Views:
    234
    Peter Pan
    Jan 11, 2005
Loading...

Share This Page