__attribute__((constructor)), shared object files and C++...
Daniel Jacobowitz
drow@mvista.com
Thu May 8 17:53:00 GMT 2003
On Thu, May 08, 2003 at 10:38:48AM -0700, Pearson, Scott wrote:
> For the C++ case, I ended up with the (somewhat similar) sequence:
>
>
>
> g++ -fPIC -c libctest.cpp
>
> g++ -shared -Wl,-soname,libctest.so.1 -o libctest.so.1.0
> libctest.o
>
> ldconfig -v -n .
>
> ln -sf libctest.so.1 libctest.so
>
> g++ -o ctest -L. -lctest -lstdc++ ctest.cpp
>
>
>
> This didn't work; the module constructors/destructors were not executed.
> Where did I go wrong?
Sorry, nothing obvious jumps out at me. You don't need the -lstdc++ in
the last line though. g++ will take care of it.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
More information about the Gcc
mailing list