Re: undefined reference

Bart Trojanowski (bart@jukie.net)
Mon, 25 Mar 2002 16:45:35 -0500


--zhXaljGHf11kAtnf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Anthony Chee <anthony.chee@polyu.edu.hk> [020324 11:17]:
> I am now developing a module. This module need communicate with the kerne=
l.
> So I exported a function func(), by using EXPORT_SYMBOL(func). In the hea=
der
> 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.

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

--zhXaljGHf11kAtnf
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8n5p/kmD5p7UxHJcRAnGAAJ40wZDL2LLYMdSVQ+hmJe/FpsBvPQCfaB9q
Dw+WW7brhnzPPniFJeG/yKw=
=Keu5
-----END PGP SIGNATURE-----

--zhXaljGHf11kAtnf--
-
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/