Unnecessary globals in libraries.

Doug Gwyn gwyn at smoke.ARPA
Wed Oct 5 16:05:28 AEST 1988


In article <LJZ.88Oct3142203%fxgrp.fx.com at ames.arc.nasa.gov> ljz%fxgrp.fx.com at ames.arc.nasa.gov (Lloyd Zusman) writes:
>Is there any way in BSD systems and SYSV systems for me to build my
>library with the three object files as defined above and still cause
>the common[1-3] routines to be unknown to the users of the library?

Not unless your linker supports some form of global symbol mapping.
The usual solution is to either use names starting with at least one
underscore (e.g. mine might be _DAG_whatever), since no sane
application will define its own externs with names like that,
or to use some common prefix for all the "internal" names in your
library (e.g. mine might be DAGwhatever) and warn your customers
about this reservation of a portion of name space for your library.

Old CDC Fortran compilers used to use names like Q8Qxxx for library
functions, and few users had a problem with it.



More information about the Comp.unix.wizards mailing list