Suposse I coded the C library, which provides a bunch of "public" functions declared in the mylib.h header file. These functions are supposedly implemented in the (say) mylib.c file, which is compiled into (say) the static lib mylib.c -> mylib.o -> mylib.a .
Is there any way to discover that I forgot to provide an implementation of some declared function in mylib.h ? (Yes, I know about unit testing, best practices, etc. - and, yes, I understand the meaning of declaring a simple function in C).
Suppose mylib.h declares a void func1(); , and this function was not encoded in the provided library. This will only cause an error if the linker should use this function. Otherwise, it will compile normally and even without warning - AFAIK. Is there a way (possibly dependent on a compiler) to trigger a warning for declared but not implemented functions, or is there any other way to deal with this problem?
BTW: nm -u does not list all undefined declared functions, but only those "used" by the library, i.e. these functions which will cause an error in the binding phase if it is not announced somewhere. (Which makes sense, the library object file does not know about header files, of course.)
source share