public inbox for linux-newbie@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@stusta.de>
To: Rajat Jain <rajat.noida.india@gmail.com>
Cc: Linux Newbies <kernelnewbies@nl.linux.org>,
	newbie <linux-newbie@vger.kernel.org>
Subject: Re: Accessing static variable from outside
Date: Sat, 16 Jun 2007 05:09:26 +0200	[thread overview]
Message-ID: <20070616030926.GS3588@stusta.de> (raw)
In-Reply-To: <b115cb5f0706151908o6a0f765etd5f275be8bf75f0@mail.gmail.com>

On Sat, Jun 16, 2007 at 07:38:07AM +0530, Rajat Jain wrote:
> Hi,
>
> I understand that this is off-topic, but still if some one has any ideas 
> ...
>
> I have a global variable that is defined static in an object file (say
> 1.o). Now I want to be able to get the value of this variable in
> ANOTHER object file (say 2.o) without changing the source of 1.c.
>
> Any ideas, anyone? I know that as per C, this is not possible. But may
> be some clever hack?

Depending on how the variable gets used the compiler might even 
completely optimize it away.

> Thanks,
>
> Rajat

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

  reply	other threads:[~2007-06-16  3:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-16  2:08 Accessing static variable from outside Rajat Jain
2007-06-16  3:09 ` Adrian Bunk [this message]
2007-06-16 16:36 ` tejas khatiwala
2007-06-17 10:20   ` Erik Mouw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070616030926.GS3588@stusta.de \
    --to=bunk@stusta.de \
    --cc=kernelnewbies@nl.linux.org \
    --cc=linux-newbie@vger.kernel.org \
    --cc=rajat.noida.india@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox