Problem of undefined reference

From: sakib mondal (sakib@hotmail.com)
Date: Fri Jan 10 2003 - 07:52:27 EST


Hi,

Wish you all a happy new year.

I appologize in case you are getting multiple copies of this message.

I am facing the problem of "undefined reference" for my task of using
extended functionality of linux kernel (2.4.18) as detailed below. I shall
appreciate any suggestion to solve the problem.

I would like to incorporate new functions into linux kernel. Therefore I
created a file f.c with function "void foo()". Source f.c uses header file
f.h. The header file "f.h" has declaration "extern void foo(void);". I
included f.o in the obj-y in the Makefile in the corresponding directory. I
could build the new kernel without any error or warning.

Now, I intended to use the extended functionality of the kernel from my
program. I wrote g.c which calls foo(); I have included header f.h in g.c.
However when I build g, I get the error:

"g.o(.text+ox35): undefined reference to `foo`".

I am unable to understand why "foo" is not resolved as the resident kernel
ius built with object f.o. To diagonose the problem further I did the
follwing things which could neither solve my problem.

i) Used "EXPORT_SYMBOL(foo);" in f.c and had f.o included in export-objs in
the Makefile. ==> I still get the problem of undefined reference

ii) Defined library libf.a based on f.o and included the library for
building g. ==> The kernel is agin built ok. I could see (using nm) that the
symbol foo in defined with type T. However, when building g, I am getting
lot of undefined references to kernel variables and routines that are used
in foo.

I shall appreciate any suggestion or alternative for solving the problem.

TIA.

Sakib

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus

-
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 : Wed Jan 15 2003 - 22:00:32 EST