Shared variables (between ELF executables)

Sven Eschenberg eschenb@cs.uni-frankfurt.de
Wed Mar 22 11:30:00 GMT 2006


Hi there,

this seems a little odd to me. In case of different Processes you will 
need some IPC mechanism, but if it's just .so files, just define the 
variable once and link all others against this variable ... isn't that 
the most comon thing to do? (Maybe I am missing something here?)

-Sven


sam_14332 wrote:

>Hello!
>
>I want a variable to be shared between several ELF executables in the same
>process image - e.g. different .so files and the program executable.
>
>And I don't want the value of the variable to be just copied between the
>executables (this is currently what happens for me) - i want all references
>to the variable in all executables to be dynamically linked against the same
>memory-location in a .so file.
>
>What is the soulution? Some command-line argument to ld? Some change in the
>linker script? Something with the __attribute__ stuff? Please HELP!
>--
>View this message in context: http://www.nabble.com/Shared-variables-%28between-ELF-executables%29-t1323226.html#a3530268
>Sent from the gcc - Help forum at Nabble.com.
>  
>



More information about the Gcc-help mailing list