Paul, Thanks for an exhaustive reply. At least you gave me some benefit of the doubt when questioning why I didn't provide an example. Unfortunately, the short example I came up works slightely differently what I was describing. So it didn't quite fit my description of the problem. The example that I had, which works in a different way altogether, is as follows:
a.cpp: #include <iostream> #pragma weak anonexistant void anonexistant(void); void a() {std::cout << "in a()" << std::endl;} void aempty() {std::cout << "in aempty()" << std::endl; anonexistant();} b.cpp: #include <iostream> void b() {std::cout << "in b()" << std::endl;} c.cpp: #include <iostream> extern void a(); extern void b(); int main() { a(); return 0; } $ g++ -fPIC -c -o a.o a.cpp; g++ -fPIC -c -o b.o b.cpp; g++ -fPIC -c -o c.o c.cpp $ ar rcu libtst.a a.o b.o; ranlib libtst.a $ g++ -Xlinker --allow-shlib-undefined -o tsta c.o libtst.a This doesn't link with the following error: libtst.a(a.o)(.text+0x190): In function `aempty()': : undefined reference to `anonexistant()' That is a surprise since aempty is not called at all. I suppose that since a function from a.o was needed, all of its functions were pulled in and thus required resolution. If that is the case, then it is something new to me as I always thought that functions were resolved and used one at a time. This example seems to imply that once a file is opened and one function from it is used, all of the functions have to be resolved. Going back to your explaination... The object files that contain functions referring to the missing callbacks are pretty big. It is hard for me to imagine that all of the functions in a give object file are left out of linking. So I still don't understand how .a links and .so has has problems. It would appear to me that both of the libraries should have problems. My actual code files would be closest to your example 2. Is there any way to resolve that situation so that the program links with a .so and runs? We know that the porgram will never call the functions invoking a missing callback. Thanks. _______________________________________________ Help-gplusplus mailing list Help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus