Re: global variable

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

 



On Thursday 10 March 2005 07:18, sounak  chakraborty wrote:
> 
> i want to declare and initialise  a static int variable at linux/proc_fs.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).


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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