Adding a function to glibc?
Mike Frysinger
vapier@gentoo.org
Wed Oct 21 22:51:00 GMT 2009
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/libc-help/attachments/20091021/52f0277f/attachment.sig>
More information about the Libc-help
mailing list