This is the mail archive of the libc-help@sourceware.org mailing list for the glibc 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]

Global variables and shared libraries


I want to export a global variable that has been defined in a
shared library to the binary that links with it. The most common
approach would be to declare the global variable as an extern
variable in the application code. This approach would make the
actual reference to the global variable be present in the data
segment of the binary. My use case would require that the
reference not be present in the data segment of the binary. I am
wondering if there is anyway I can export a global variable from
a shared library so that it doesnt end up in the binaries data
segment after linking. I was thinking some what in the way errno
is linked, but I believe it ends up as a function call eventually
so that appropriate address can be dereferenced, please do
correct me if I am wrong. I do not want to access the variable
using get/set calls either. If this is not the appropriate forum
for this question, I would greatly appreciate it if you could
point me in the direction of a more suitable forum as well.

-- 
Bharath


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