Is it possible for a function in a linux kernel module calling a function in another module ?
Asked
Active
Viewed 2,680 times
2
-
1http://stackoverflow.com/questions/9820458/kernel-modules-develop/9820518#9820518 – Jeyaram Feb 19 '16 at 12:11
-
Possible duplicate of [How to call exported kernel module functions from another module?](http://stackoverflow.com/questions/12311867/how-to-call-exported-kernel-module-functions-from-another-module) – Ciro Santilli OurBigBook.com May 20 '17 at 12:29
-
I wonder why no one else mentioned this. EXPORT_SYMBOL and extern
is not enough. In the Kbuild file of the module that is importing symbol, add a line KBUILD_EXTRA_SYMBOLS = – Sadman Sakib Jun 29 '23 at 19:51/Module.symvers . This helps the importing module know what symbols will be imported.
2 Answers
1
It is possible by using EXPORT_SYMBOL
in Linux.
If one module has one function called etx_shared_func
and one global variable called etx_count
. This function and variable can be shared among with all the loadable modules using EXPORT_SYMBOL
.
EXPORT_SYMBOL(etx_shared_func);
EXPORT_SYMBOL(etx_count);

avariant
- 2,234
- 5
- 25
- 33

Anshu Gaur
- 11
- 1