Re: extern variables in .c and .h files

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

 



On Thu, Dec 04, 2003 at 21:34:43 +0100, threadhead@web.de wrote:
> hi!
> 
> i've been been coding a LKM that should be
> able to use variables, that are declared as extern.
> i am using a 2.4.20 kernel.
> 
> the module is based on some code of
> kernel/module.c.
> (http://lxr.linux.no/source/kernel/module.c)
> 
> well, i tried different stuff with that LKM now.
> take as an example:
> i have the tulip module loaded. with my LKM i can make use of
> extern const char * const medianame[];
> (http://lxr.linux.no/source/drivers/net/tulip/tulip.h)
> and display it, when using the same declaration in my LKM.
> 
> but for some strange reason i cannot use
> variables that were declared a similar way in .c files in the
> kernel source tree.
> for example:
> extern const struct exception_table_entry __start___ex_table[]; (kernel/module.c)
> 
> why can i access extern vars from header files and not
> from source C files, that have been compiled as
> part of my current kernel?

Only symbols declared EXPROT_SYMBOL (see kernel/ksyms.c) are available
to modules. Symbols defined by modules are exported by default unless
turned off.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
--
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