Changing symbols to "static"

John O'Brien jobrien at nixbur.UUCP
Wed Oct 31 08:14:44 AEST 1990


Is there some way to change a symbol's class to "static" in a ".o" file?
Suppose I have a ".c" file with functions "a" and "b", and global variables
"x" and "y":

int c, d;

a()
{
  ...
}

b()
{
  ...
}

Suppose also that I have another ".c" file that refers to "a",
"b", "c" and "d":

external int c, d;

spot()
{
   ...

   a();
   b();

   ...
}

so I can't just make any of the symbols "static".  Now
suppose that I want to use the function "spot" two ways:  I want to
link it in with my own application, where I am not worried about "a"
and "b" being linked in inadvertently, and I also want to make "spot"
and only "spot" available to someone else for linking.  I think it
would be possible to combine the two ".o" files into one ".o" file,
but would it then be possible to change the class of "a", "b", "c" 
and "d" to static so that they would not be exported to the linker?

				Thanks

internet:  obrien.bur at nixdorf.com
uucp: linus!nixbur!jobrien


Flying saucers, levitation/Yo!  I can do that!  - D. Byrne



More information about the Comp.unix.questions mailing list