This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Shared variables (between ELF executables)


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.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]