I assume for simple C libraries you can use nm -D output in your real shared library to make a stub. For example, you can pass it into a small awk script that defines functions with the same name, etc.
Another approach would be to make your little MELT extension to the recent GCC , which would generate a stub (for example, in the form of C ++ or C) when compiling a real library or clear every function body (in a special mode to compile only stub libraries). This will work in any language compiled by GCC (but requires some understanding of the internal components of GCC, such as Trees and Gimples). Ask gcc-melt@googlegroups.com
However, I am not sure to understand the practical interest of such stubs. In practice, the shared library contains some specific encoding rules and their use, and this is not verified using stubs. To be specific, if you use Xlib, you need to first call XOpenDisplay and XCloseDisplay , and such a rule cannot be verified with an automatically generated stub, etc.
source share