Hi,
I want to make a library in c that any user program can include
I know that the make file of the library should be:
all: a.c b.c
gcc –c a.c –o a.o
gcc –c b.c –o b.o
ar rcs libuthreads.a a.o b.o
and the makefile of the user program is:
gcc test.c -L. -libuthreads.a
The problem:
I want the main() to be in the library - in a.c
so when i run ./test.c it will start in main() in a.c
and the main to call umain() witch is the user main
umain() is defined in a.h ( in the library) but implemented by the user test.c
when I run the library makefile all is ok
but when i run the user makefile i get a msg that umain() that is called in a.c (in main()) in not defined.
I dont know how to tell the library that umain() is defined outside of the library.
I tryed exteren but it didn't work.
and i dont want to have one make file for the library and the user files.