Yes, you'll end up having a local symbol for the static declaration and an undefined exported symbol for the extern declaration. The local symbol is not exported by definition. The undefined exported symbol cannot be exported because there is no object (i.e. variable or function) to which it is bound. -Mike DeKoker --- "Sponsel Carsten (ext)" <carsten.sponsel@erln.gepas.de> wrote: > But then I've two symbols when i view my module with > nm... > > -----Original Message----- > From: Mike DeKoker [mailto:mdekoker@yahoo.com] > Sent: Freitag, 13. Februar 2004 18:20 > To: Sponsel Carsten (ext) > Subject: Re: global Variable in multiple files > > > Just define your variable as a module-level static > and > define an external reference to it in the other > source > files. This works for functions also. > > e.g. > > /* File1.c */ > static int x; > > /* File2.c */ > extern int x; > > This assumes that File1.o and File2.o are being > relocatably linked into a single object file. (Since > you're coding for a module they should be.) > > -Mike DeKoker > > --- "Sponsel Carsten (ext)" > <carsten.sponsel@erln.gepas.de> wrote: > > Hi friends, > > > > it might be a simple question: > > > > What's the best way to get (to define) a global > > variable which can be used in multiple files of a > > kernel module in Linux Kernel 2.6? The variable > > should not be exported as a symbol. In my special > > problem I need an array of a struct which is > useable > > in all sourcefiles which form my kernel module. > > > > thanks, > > Carsten > > > snip > > __________________________________ > Do you Yahoo!? > Yahoo! Finance: Get your refund fast by filing > online. > http://taxes.yahoo.com/filing.html __________________________________ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/