Reputation: 11731
I'm trying to add a new function to libsoup. I've gotten libsoup itself to compile correctly with my new function in it; I've also added the function prototype to the relevant header file. However, when trying to compile a test program against the local so
, the linker complains that the reference to my new function is undefined. Checking with objdump -T
, I can see that the function is there in the library, but not when checking with nm -C -D
. Even if I globalize the symbol using objcopy
, nm
still can't see it.
I've also already tried adding __attribute__((visibility("default")))
, but it doesn't seem to help.
I use this compiler invocation for my test program:
gcc -o test -I. -I $prefix/include/glib-2.0/ -I $prefix/lib/glib-2.0/include/ -L libsoup/.libs/ test.c -lsoup-2.4
Upvotes: 1
Views: 80
Reputation: 11731
It turned out that there is a libsoup/libsoup-2.4.sym
file listing all the exported symbols in the repository. After adding my new function name to that file, I had to rm libsoup/libsoup-2.4.la
and run make
again, which resulted in my new function being available for use in my test program.
Upvotes: 1