basic doubt on shared libraries

R

ragi

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
 
W

Walter Roberson

ragi said:
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.
 
H

hzmonte

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.
 
G

Gordon Burditt

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top