This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: dynamic library loading and c++ exception
- To: Vianney Lecroart <lecroart at nevrax dot com>
- Subject: Re: dynamic library loading and c++ exception
- From: "H . J . Lu" <hjl at valinux dot com>
- Date: Tue, 23 Jan 2001 22:55:01 -0800
- Cc: gcc at gcc dot gnu dot org
- References: <004801c08542$a97fe1c0$0901a8c0@vianneyl>
On Tue, Jan 23, 2001 at 02:44:52PM +0100, Vianney Lecroart wrote:
> Hello All.
>
> I'm using RedHat7.0 and gcc 2.96.
> I wrote a tiny C++ program that simply loads a (C++) dynamic library,
> calls a function and unloads it. The problem is that if an exception
> is thrown inside the library (and caught there) the program aborts.
> The output is:
>
> [alfa:~/tmp] app
> Abort
>
> In particular, if I comment out the "throw" line in the lib, everything
> works well. Does somebody knows what's going on? Since I have no idea
> about it, maybe I'm sending this to the wrong list--excuse me for that.
>
> Please, c.c. the answer to me because I'm not a list member.
>
> Code for both files follows, app.cpp is the application and lib.cpp is
> the dynamic library.
>
It works for me under RedHat 7.0. I guess you didn't build the shared
library right. I used
# gcc -shared -o liblib.so -fPIC lib.cpp
H.J.