Re: undefined reference

From: Bart Trojanowski (bart@jukie.net)
Date: Mon Mar 25 2002 - 16:45:35 EST


* Anthony Chee <anthony.chee@polyu.edu.hk> [020324 11:17]:
> I am now developing a module. This module need communicate with the kernel.
> So I exported a function func(), by using EXPORT_SYMBOL(func). In the header
> file, I set "extern int func()".
<snip>

The problem you face is that the kernel needs to know where foo is to
generate a the bytecode that calls it. Here is a better scenario...

You expose an interface in the kernel such as

        typedef void (*func_t)(int);
        void register_func ( func_t func );
        EXPORT_SYMBOL (register_func);

Then in your modules you call 'register_func' and that will pass the
function in question to the kernel. The kernel can then do whatever it
wants to that pointer (like call it).

B.

-- 
				WebSig: http://www.jukie.net/~bart/sig/


- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Mar 31 2002 - 22:00:10 EST