문제

I've written three kernel modules. A, B, C. B needs some functions from A and C also. How to achieve this. Please be code specific. Any help is appreciated.

도움이 되었습니까?

해결책

Below the function implementation in A, export it:

#include "moduleA_header.h"

int foo(void)
{
    printk(KERN_NOTICE "Hi there!\n");
}
EXPORT_SYMBOL(foo);

Make sure that the prototype of your function is declared in a header file that you can include in module B. Also, make sure module A gets loaded before module B.

Just make sure that your include has the path right to the moduleA_header.h file.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top