Hasan Mahmood <hasan.mahm@xxxxxxxxx> 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