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: problems catching std::runtime_error in a .so built with -fPIC


Hasan Mahmood <hasan.mahm@gmail.com> writes:

> I am having a problem trying to catch std::runtime_error (thrown from
> libstdc++) in a .so I built with -fPIC. If I build without -fPIC, I
> can catch the exception. Here is the code in the .so:

What operating system are you using?

What version of gcc are you using?

What happens when the program does not work as you expect?

In general you can only catch an exception thrown by a shared library if
you are using a shared libgcc or if you are using a linker which
supports the --eh-frame-hdr option.  So first confirm that one or the
other is the case.  Use ldd to see whether you are linking against a
shared libgcc (named libgccc_s).  Use -v when linking to see whether gcc
pases --eh-frame-hdr to the linker.

Ian


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