trying to understand undefined reference for dladdr

Mike Frysinger vapier@gentoo.org
Tue Aug 18 23:21:00 GMT 2009


On Tuesday 18 August 2009 18:56:12 Brendan Miller wrote:
> I have some code like:
>
> #include <dlfcn.h>
> ...
> // function call in some code later.
> dladdr(addr, &addrInfo);
>
> That is compiled into a static library libmy_library.a
>
> When I go to link the library into the program containing my main
> routine I get this:
> g++ -o program -rdynamic main.o  libmy_library.a
> libmy_library.a(my_library.o): In function `SomeFunction(void*)':
> /path/to/src/my_library.cpp:68: undefined reference to `dladdr'
> collect2: ld returned 1 exit status

did you try linking against libdl like the man page says to ?
-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/20090818/3dbd1128/attachment.sig>


More information about the Libc-help mailing list