I will try to make the question clear. I am developing a loadable kernel module and just wondering whether I can call a static inline function defined in another header file of the Linux kernel source. I understand that the static keyword makes the function restricted within the scope of the compilation unit(i.e. a C file). But if I include the header file where the static inline function is defined, can I use it in my module?
Asked
Active
Viewed 1,625 times
1
-
What else would you do with a function (static inline or not) than to call it? Did you try? – CL. Jul 05 '14 at 08:58
1 Answers
2
Whether I can call a static inline function defined in another header file of the Linux kernel source??
Yes. Possible. kmalloc() is an example for it. This function is defined in include/linux/slab.h as a static inline
function. Suggest to read this post which explains why static inline is used in header files.
References
http://lxr.free-electrons.com/source/include/linux/slab.h#L452
What's the difference between "static" and "static inline" function?