This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: __attribute__((constructor)), shared object files and C++...


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]