This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Adding a function to glibc?


On Wednesday 21 October 2009 18:45:31 Almohri, Hussain wrote:
> I'm doing some tests on glibc. I'd like to add new functions to it. For a
> test, I create a file and put a simple function putct in it and just for
> testing I put it in stdlib folder.
> I added the function name to the routines section of the Makefile. In the
> header file stdlib/stdlib.h, I added this line: extern int putct(int c);
> 
> I also added the function in stdlib/Versions
> 
> I run make and make install. Everything was OK. But when I write a sample
> program to test this function, gcc says:
> 
> /tmp/ccq6R9BD.o: In function `main':
> test.c:(.text+0x11): undefined reference to `putct'
> collect2: ld returned 1 exit status

make sure the function is exported in the new libc.so (use `readelf -s` to 
see)

> I already pointed to the modified library when running gcc.

are you sure you're linking against the new one ?  use -Wl,--verbose to see 
the files that the linker is actually using.
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]