Shared Lib Question (ISC)

John F Haugh II jfh at rpp386.cactus.org
Mon May 20 03:52:29 AEST 1991


In article <23997:May1901:27:0891 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
>Okay. Do you agree, then, that global variables (or at least static
>variables) can be part of a well-designed, well-programmed library?

Sure.  But you can't get to the rest of your argument by this point.

> In
>other words, do you agree that there are well-designed, well-programmed
>libraries (like malloc() or stdio) which cannot be put into a ``pure''
>shared library without some work?

Nope.  Define "some work".  I don't know what the hell your agenda
is, but I really resent this notion that the implementations that _do_
exist somehow _don't_ exist.

>                                   In other words, do you agree that
>``pure'' shared libraries restrict a good programmer, by forcing him to
>do extra work to make some of his libraries sharable? In other words, do
>you agree that the feature of ``impure'' shared libraries is indeed
>beneficial in some cases?

No.  Pure code has its own rewards, in particular, it can be used for
purposes which the author originally did not imagine.  For example, if
malloc() took the address of a structure describing 1) the arena in
some abstract terms, 2) the address of a function to get more memory,
and 3) the address of a function to return unneeded memory, the
standard malloc() function could be adapted to work with kernel
virtual memory, local static memory, mapped file memory, etc.  Instead,
it is married to the user application and memory in the data segment
only.  Sounds like quite the well-designed piece of code to me.  The
more you pin down with hidden state the less you are free to adapt
the code to your own uses.  As just one example, what is the difference
between DBM and NDBM?  DBM uses a global data structure and supports
at most one open database at a time.  NDBM takes a handle to the
open database and supports multiple open databases.  Is this a
coincidence?

>Good. Glad we settled that.

In your mind, Dan.  In your mind.
-- 
John F. Haugh II        | Distribution to  | UUCP: ...!cs.utexas.edu!rpp386!jfh
Ma Bell: (512) 255-8251 | GEnie PROHIBITED :-) |  Domain: jfh at rpp386.cactus.org
"If liberals interpreted the 2nd Amendment the same way they interpret the
 rest of the Constitution, gun ownership would be mandatory."



More information about the Comp.unix.internals mailing list