sounak chakraborty wrote:
In general, if x.c file calls a function in y.c , it would include the header file for y.c i.e y.h .
> > (i want to make it a global variable) > >If you put a static in a header, then any .c that includes it will >have its own private copy of that variable. From what you describe, >you do not want it to be static. Define the variable in one .c file >and declare it extern whereever you want to use it (a header would >be a good place for something like that).
i am not able to solve it i think i am making it complex can you tell me a way so that /kernel/fork.c can call a function of /fs/proc/root.c
But including a .c file from within another .c file doesn't make sense and is not a proper way of building programs.
if i can include the root.c file in the fork.c then the work becomes easier but i am unable to do it..can i do it ? how?
No , its not the proper way.
if no then what will be other procedure
i just simply want to set a value to a variable in root.c and it should reflect the value in fork.c(it can access the changed value)
ok , declare the variabe as global in root.c say , int root_flag;
in fork.c extern int root_flag;
and it would reflect that value of root_flag at root.c, when used in fork.c.
Well, having said that , these are all basic programming techniques , and i think you should be clear about them
before moving ahead. Good luck.
cheers, Amith.
can you tell me any other way out thanks i will be very greateful sounak
<http://clients.rediff.com/signature/track_sig.asp>