On Wed, 28 Feb 2001, Joe Harrington wrote:
> Does anyone know how exactly EXPORT_SYMBOL(blah) works. For example in my
> simple module that I created I have a
> struct proc_dir_entry stuctName;
> declared, can I put a link to structName in two other modules as well by
> using EXPORT_SYMBOL.
Presuming you are talking about EXPORT_SYMBOL in the Linux
kernel :), you might be better off asking the question
on the kernelnewbies[1] list, but I'll give a go..
EXPORT_SYMBOL is used to define symbols which may
be used from other modules. So unless you are writing
a stack of modules you won't need it.
What EXPORT_SYMBOL actually does is define the address
and name of all the symbols exported from the module or
kernel with EXPORT_SYMBOL in the __ksymtab section. Insmod
uses this info to load the module and relocate symbols. It
will refuse to load a module that tries to use any kernel
symbols not defined in then kernel's __ksymtab section.
You can see what symbols are exported by the kernel using
> objdump --disassemble -j __ksymtab /boot/vmlinux-2.4.2
for example.
It's a little bit more complicated when you have MODVERSIONS
turned on, but the concept is the same.
Good Luck,
Mark
[1] see the top of
http://www.kernelnewbies.org/mailinglist.php3
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!