Shared Lib Question (ISC)

Alex Goykhman goykhman_a at apollo.HP.COM
Fri May 17 06:58:00 AEST 1991


In article <7516 at segue.segue.com> jim at segue.segue.com (Jim Balter) writes:
>In article <19256 at rpp386.cactus.org> jfh at rpp386.cactus.org (John F Haugh II) writes:
>>There is a difference between `state' and `global variables'.  For example,
>>the stdio library you mention, could keep its state in the (FILE *) object
>>you pass as its argument in the `no global variables' version of our
>>stdio library.
>
>However, ANSI mandates that fclose(NULL) close all open FILEs, which requires
>a global pointing to the list of FILEs.  Of course, fopen could be a non-shared
>wrapper around a shared global routine; you would also need fopen and fdopen to
>be wrappers, since they need to hang new FILEs on the list.  So, one can
>implement the C library as a shared library without globals if one is willing
>to claim that the wrappers and the overhead they require isn't part of the
>implementation, but that is stretching it.

    Fclose(NULL) is only defined within the context of a single process, all it 
    needs to do is to go through the per-process fd table and and close every fd that
    remains open.  It should be easy to implement this call as a part of a shared
    library, and I am not sure what kind of overhead you are referring to.

[deleted]


Alex Goykhman                    speaking for myself  
Chelmsford System Software Lab   mit-eddie!apollo!goykhman_a
Hewlett-Packard, Company         goykhman_a at apollo.hp.com



More information about the Comp.unix.internals mailing list