Re: EXPORT_SYMBOL Vs extern?
pradeep singh wrote: Hi All, A Quick but perhaps dumbass query, 1. int function_A(...) { ...; } 2. int function_B(...) { ...; } EXPORT_SYMBOL(function_B); Okay i understand I should use the EXPORT_SYMBOL way if i want function_B to be used by rest of the kernel. Functions and variables which are exported through EXPORT_SYMBOL is for kernel module code. Now I have a doubt - Is it a compulsion for a function which need to be used in any other source file, exported through EXPORT_SYMBOL only? Does this means all the places in kernel(and there are loads of them), where a function is non-static and is used in other source files should actually be using EXPORT_SYMBOL? Thanks, ~Pradeep -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to [EMAIL PROTECTED] Please read the FAQ at http://kernelnewbies.org/FAQ
RE: EXPORT_SYMBOL Vs extern?
Hi, Is it a compulsion for a function which need to be used in any other source file, exported through EXPORT_SYMBOL only? Does this means all the places in kernel(and there are loads of them), where a function is non-static and is used in other source files should actually be using EXPORT_SYMBOL? EXPORT_SYMBOL is mandatory if you want to use a kernel defined function in a module (or vice versa), or a module defined function in a different module. You can use a non-static function (defined in say A.obj) in a different obj file (defined in say B.obj) provide that both the objs either belong to the same module, or are linked in the kernel at the compile time. Thanks, Rajat -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to [EMAIL PROTECTED] Please read the FAQ at http://kernelnewbies.org/FAQ
RE: EXPORT_SYMBOL Vs extern?
EXPORT_SYMBOL macro creates a new kernel symbol entry (address of the symbol, symbol) based on the value you specify and puts it in a special section of the kernel image, in __ksymtab section. When modules are loaded dynamically, the loader resolves the symbols during run time by parsing the entries of this section. Extern can be used for non-static functions that are statically linked during compile time. HTH, Ani -Original Message- From: [EMAIL PROTECTED] [mailto:kernelnewbies- [EMAIL PROTECTED] On Behalf Of pradeep singh Sent: Sunday, May 04, 2008 10:38 PM To: Kernel List Subject: EXPORT_SYMBOL Vs extern? Hi All, A Quick but perhaps dumbass query, 1. int function_A(...) { ...; } 2. int function_B(...) { ...; } EXPORT_SYMBOL(function_B); Okay i understand I should use the EXPORT_SYMBOL way if i want function_B to be used by rest of the kernel. Now I have a doubt - Is it a compulsion for a function which need to be used in any other source file, exported through EXPORT_SYMBOL only? Does this means all the places in kernel(and there are loads of them), where a function is non-static and is used in other source files should actually be using EXPORT_SYMBOL? Thanks, ~Pradeep -- play the game -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to [EMAIL PROTECTED] Please read the FAQ at http://kernelnewbies.org/FAQ