How to detect unresolved symbol when creating a library ?
Posted
by Simon
on Stack Overflow
See other posts from Stack Overflow
or by Simon
Published on 2010-04-16T12:00:30Z
Indexed on
2010/04/16
12:03 UTC
Read the original article
Hit count: 258
Hello everyone,
Under Solaris 10, I'm creating a library A.so that calls a function f() which is defined in library B.so. To compile the library A.so, I declare in my code f() as extern.
Unfortunately, I "forgot" to declare in A's makefile that it has to link with B. However, "make A" causes no warning, no error, and the library A.so is created.
Of course, when executing A's code, the call of f() crashes because it is undefined.
Is there a way (linker option, code trick...) to make the compilation of library A fail ? How can I be sure that all symbols refered to in library A are defined at compile time ?
Thanks for any suggestions.
© Stack Overflow or respective owner