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 the line "unsubscribe linux-newbie" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

[Index of Archives]     [Audio]     [Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux