Changing symbols to "static"

Curtis Yarvin cgy at cs.brown.edu
Mon Nov 5 05:06:08 AEST 1990


In article <3653 at vela.acs.oakland.edu> srodawa at vela.acs.oakland.edu (Ron Srodawa) writes:
>In article <3693 at skye.ed.ac.uk> richard at aiai.UUCP (Richard Tobin) writes:
>>In article <781 at nixbur.UUCP> jobrien at nixbur.UUCP (John O'Brien) writes:
>>>Is there some way to change a symbol's class to "static" in a ".o" file?
>>
>>Almost certainly.  Examine the format of symbol table entries, and see what
>
>Uh?  Static variables are allocated storage in a different place than
>non-static variables.  Non-static local variables are allocated on the
>stack, static variables along with the text.  I would expect the easiest

It would appear we have a terrible misunderstanding here; so, before we get
an accidental flame war, let's break this thing up.  There are two things
you can do with the "static" keyword in C.  You can tell the compiler to keep
a _local_ variable in the data segment instead of the stack.  Or you can
prevent routines in other files from accessing a _global_ variable in a file.

	The first cannot be altered without a good disassembler.  The second
can.  Which the original poster was referring to is anyone's guess; maybe he
can post again & tell us.

		-Curtis

"I tried living in the real world
 Instead of a shell
 But I was bored before I even began." - The Smiths



More information about the Comp.unix.questions mailing list