basic doubt on shared libraries

Discussion in 'C Programming' started by ragi, Aug 26, 2006.

  1. ragi

    ragi Guest

    Hi Friends,

    Could you please tell me about,

    1. What a shared library in c contains
    2. (.a) file extension for shared libraries.
    3. Is shared libraries are reentrant.


    Thanking you in advance,
    ragi
    ragi, Aug 26, 2006
    #1
    1. Advertising

  2. In article <>,
    ragi <> wrote:

    > Could you please tell me about,


    > 1. What a shared library in c contains
    > 2. (.a) file extension for shared libraries.
    > 3. Is shared libraries are reentrant.


    In answer to your first question: NO, all of those are off-topic
    here. Shared libraries mean different things in different implementations.
    As in a newsgroup more specific to your implementation.
    --
    Prototypes are supertypes of their clones. -- maplesoft
    Walter Roberson, Aug 26, 2006
    #2
    1. Advertising

  3. ragi

    Guest

    Re: basic doubt on shared libraries

    There is a wikipedia entry for Library which explains shared libraries:
    http://en.wikipedia.org/wiki/Library_(computer_science)
    I may be wrong, but I think whether a library (function) is reentrant
    or not depends on how you code it. You can use some non-reentrant
    system call or library function in your library, and then your library
    becomes non-reentrant. If you use reentrant system calls or functions
    in your library, then your library is reentrant. Actually, I think it
    is more correct to say whether a function, rather than a library, is
    reentrant. Some functions in a library may be reentrant, whereas
    others in the same library are non-reentrant.
    , Aug 27, 2006
    #3
  4. Re: basic doubt on shared libraries

    >There is a wikipedia entry for Library which explains shared libraries:
    >http://en.wikipedia.org/wiki/Library_(computer_science)
    >I may be wrong, but I think whether a library (function) is reentrant
    >or not depends on how you code it.


    True, it's possible to make a function non-reentrant unnecessarily
    by poor cooding.

    However, some functions, like strtok() as defined by Standard C,
    cannot be made reentrant and still conform to the requirements for
    the function. You can sometimes add an argument that points to
    storage that holds state for the function to make it reentrant, but
    then it no longer has the same function signature required. It's
    now a different function and it needs a different name.

    >You can use some non-reentrant
    >system call or library function in your library, and then your library
    >becomes non-reentrant.
    >If you use reentrant system calls or functions
    >in your library, then your library is reentrant. Actually, I think it
    >is more correct to say whether a function, rather than a library, is
    >reentrant.


    A reasonable definition of a "reentrant library" would seem to be:
    A library is reentrant if and only if all of the functions in it
    are reentrant.

    >Some functions in a library may be reentrant, whereas
    >others in the same library are non-reentrant.


    It is sometimes the case that a non-reentrant initialization function
    must be called before any of the other functions are used, and that
    the reentrant functions use a number of "write-once" variables set
    by the initialization function (for example, loading locale-specific
    messages for the appropriate language). This would make the library
    non-reentrant even if there is no explicit call to the initialization
    function since the shared library mechanism automatically calls it.
    Gordon Burditt, Aug 27, 2006
    #4
    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. Bob Nelson

    doubt about doubt

    Bob Nelson, Jul 28, 2006, in forum: C Programming
    Replies:
    11
    Views:
    601
  2. Karsten Wutzke
    Replies:
    21
    Views:
    904
    Roedy Green
    Jun 29, 2007
  3. Replies:
    0
    Views:
    542
  4. Peter Otten
    Replies:
    2
    Views:
    104
    Cousin Stanley
    Aug 10, 2013
  5. Terry Reedy
    Replies:
    0
    Views:
    109
    Terry Reedy
    Aug 10, 2013
Loading...

Share This Page