On 4/21/07, Thomas Christensen <thomasc@xxxxxxxxxxx> wrote:
Hi kernelnewbies, I am building 2 out of tree modules which looks like this: foo1.c: #include <linux/module.h> #include <linux/kernel.h> void foo1_hello(void) { printk(KERN_INFO "foo1: hello\n"); } EXPORT_SYMBOL(foo1_hello); int init_module(void) { return 0; } void cleanup_module(void) { } foo2.c #include <linux/module.h> #include <linux/kernel.h> extern void foo1_hello(void); int init_module(void) { foo1_hello(); return 0; } void cleanup_module(void) { } as you can see, foo2 would like to call the function foo1_hello() in foo1. When I compile the modules I get the following outputs: foo1: thomasc@toshiba:~/tests/foo1$ make make -C /lib/modules/2.6.18-4-686/build M=/home/thomasc/tests/foo1 modules make[1]: Entering directory `/usr/src/linux-headers-2.6.18-4-686' CC [M] /home/thomasc/tests/foo1/foo1.o Building modules, stage 2. MODPOST CC /home/thomasc/tests/foo1/foo1.mod.o LD [M] /home/thomasc/tests/foo1/foo1.ko make[1]: Leaving directory `/usr/src/linux-headers-2.6.18-4-686' all is fine, foo2: thomasc@toshiba:~/tests/foo2$ make make -C /lib/modules/2.6.18-4-686/build M=/home/thomasc/tests/foo2 modules make[1]: Entering directory `/usr/src/linux-headers-2.6.18-4-686' CC [M] /home/thomasc/tests/foo2/foo2.o Building modules, stage 2. MODPOST WARNING: "foo1_hello" [/home/thomasc/tests/foo2/foo2.ko] undefined! CC /home/thomasc/tests/foo2/foo2.mod.o LD [M] /home/thomasc/tests/foo2/foo2.ko make[1]: Leaving directory `/usr/src/linux-headers-2.6.18-4-686' a warning, which is only natural, since foo2 has no way of knowing of foo1's symbol 'foo1_hello'. Can anybody give me advise on how this can be done "the right way"?
did you insmod you foo1 before foo2 is compiled? ~psr
Thomas -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ
-- play the game -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ