Re: Possible bug with __attribute__((constructor)) and static libraries
$ make g++ module.cpp -c -O2 ar cq libmodule.a module.o g++ test.cpp module.o -o from-object g++ test.cpp -Wl,--whole-archive libmodule.a -Wl,--no-whole-archive \ -o from-lib $ ./from-object Yay life is good. $ ./from-lib Yay life is good. #include "module.hpp" #include using namespace std;
Re: Possible bug with __attribute__((constructor)) and static libraries
Dnia wtorek, 29 sierpnia 2006 10:37, TongKe Xue napisał: >If I make module.o into libmodule.a and then link libmodule.a, the > function does not get called. use -Wl,-whole-archive (man ld)