Re: Sharing static variables or function between source files.
- From: roberson@xxxxxxxxxxxxxxxxxx (Walter Roberson)
- Date: Tue, 28 Nov 2006 04:12:38 +0000 (UTC)
In article <1164683485.633254.38890@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
shantanu <shantanu.sak@xxxxxxxxx> wrote:
How can we declare a static variable or function declared in one
source file, which is to be used in other source file?
You don't. If you need to use it in another source file, do not
declare it as static, or else find a way to get a pointer to it.
For example, you could add a routine which was
SomeType MyStaticVariable;
SomeType *get_pointer_to_my_static_variable(void) {
return &MyStaticVariable;
}
Then to use the space, get_pointer_to_my_static_variable() and
use the pointer returned by that.
--
All is vanity. -- Ecclesiastes
.
- References:
- Sharing static variables or function between source files.
- From: shantanu
- Sharing static variables or function between source files.
- Prev by Date: Re: Sharing static variables or function between source files.
- Next by Date: Re: Reading a string of unknown size
- Previous by thread: Re: Sharing static variables or function between source files.
- Next by thread: Re: Sharing static variables or function between source files.
- Index(es):