Re: Accessing static variable from outside

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I leave quotations after my reply?

On Sat, Jun 16, 2007 at 11:36:43AM -0500, tejas khatiwala wrote:
> AFAIK one way to be able to access a static variable is using dynamic
> linking lodader. u can read man pages of dlopen() and family. and here is
> example of its usage http://www.slimy.com/~jleonard/src/dlopen.html

The example doesn't apply:

- - dlopen() is a userspace function and can't be used in kernel
- - dynamic linking can only be used to link exported (i.e. non-static)
  symbols

Like Adrian Bunk already explained: there are dirty tricks to get the
address of a static variable, but they will all fail when the compiler
decides to optimise the variable away (which it is completely free to
do because the "static" keyword *guarantees* that the variable will not
be used outside that particular compilation unit).


Erik

- -- 
They're all fools. Don't worry. Darwin may be slow, but he'll
eventually get them. -- Matthew Lammers in alt.sysadmin.recovery
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGdQrn/PlVHJtIto0RAsWkAJ0Qk9txqXYxwLMEeioj8z4T+74h5QCgiH51
7yl9an3I/1EPWWkw4eFqOrA=
=bEkd
-----END PGP SIGNATURE-----

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux