throwing exception from shared library...

Hi All,

I am trying to throw an exception from within an shared library, but it just
simply aborts. I am never be able to catch the exception. Also, I do
include -fexceptions during the compilation on all object files. Anything
else I have missed?

Thanks in advance.
kc

Yes, you must make sure that you tell qcc that it is a C++ shared
object. Add -lang-c++ to your link line, and it will include the
correct startup files to register your exception regions.

Cheers,

Colin

kc <kwlee@nortelnetworks.com> wrote:

Hi All,

I am trying to throw an exception from within an shared library, but it just
simply aborts. I am never be able to catch the exception. Also, I do
include -fexceptions during the compilation on all object files. Anything
else I have missed?

Thanks in advance.
kc



cburgess@qnx.com

Hi Colin,

Just want to clarify a bit.
Is the -fexceptions necessary ?
Do I add -lang-c++ to my link line when I build the shared library or the
problem?

When I throw the exception within the shared library, my program hangs.
The following is debug trace…
#0 0xb03b26e8 in find_fde () from /x86/lib/libcpp.so.2
#1 0xb03b2e60 in __frame_state_for () from /x86/lib/libcpp.so.2
#2 0xb03b15ba in next_stack_level () from /x86/lib/libcpp.so.2
#3 0xb03b17e0 in throw_helper () from /x86/lib/libcpp.so.2
#4 0xb03b1a01 in __throw () from /x86/lib/libcpp.so.2

Any idea?

Thanks again
kc


Colin Burgess wrote:

Yes, you must make sure that you tell qcc that it is a C++ shared
object. Add -lang-c++ to your link line, and it will include the
correct startup files to register your exception regions.

Cheers,

Colin

kc <> kwlee@nortelnetworks.com> > wrote:
Hi All,

I am trying to throw an exception from within an shared library, but it
just simply aborts. I am never be able to catch the exception. Also, I do
include -fexceptions during the compilation on all object files. Anything
else I have missed?

Thanks in advance.
kc

\

kc <kclee@netnobound.com> wrote:

Hi Colin,

Just want to clarify a bit.
Is the -fexceptions necessary ?

You can use -lang-c++ or it will add -fexceptions automatically
if it is a .cc/.cpp/.C file

Do I add -lang-c++ to my link line when I build the shared library or the
problem?

Both.

When I throw the exception within the shared library, my program hangs.
The following is debug trace…
#0 0xb03b26e8 in find_fde () from /x86/lib/libcpp.so.2
#1 0xb03b2e60 in __frame_state_for () from /x86/lib/libcpp.so.2
#2 0xb03b15ba in next_stack_level () from /x86/lib/libcpp.so.2
#3 0xb03b17e0 in throw_helper () from /x86/lib/libcpp.so.2
#4 0xb03b1a01 in __throw () from /x86/lib/libcpp.so.2

Strange that it would unwiding in libcpp.so.2 - can you tell me
more about what you are doing?

Any idea?

Thanks again
kc



Colin Burgess wrote:

Yes, you must make sure that you tell qcc that it is a C++ shared
object. Add -lang-c++ to your link line, and it will include the
correct startup files to register your exception regions.

Cheers,

Colin

kc <> kwlee@nortelnetworks.com> > wrote:
Hi All,

I am trying to throw an exception from within an shared library, but it
just simply aborts. I am never be able to catch the exception. Also, I do
include -fexceptions during the compilation on all object files. Anything
else I have missed?

Thanks in advance.
kc


\


cburgess@qnx.com

Colin Burgess wrote:

kc <> kclee@netnobound.com> > wrote:
Hi Colin,

Just want to clarify a bit.
Is the -fexceptions necessary ?

You can use -lang-c++ or it will add -fexceptions automatically
if it is a .cc/.cpp/.C file

Do I add -lang-c++ to my link line when I build the shared library or the
problem?

Both.

It seems to me I need to include -lang-c++ during the compilation each
object file and in the link line when I am building either shared library or
program.

When I throw the exception within the shared library, my program hangs.
The following is debug trace…
#0 0xb03b26e8 in find_fde () from /x86/lib/libcpp.so.2
#1 0xb03b2e60 in __frame_state_for () from /x86/lib/libcpp.so.2
#2 0xb03b15ba in next_stack_level () from /x86/lib/libcpp.so.2
#3 0xb03b17e0 in throw_helper () from /x86/lib/libcpp.so.2
#4 0xb03b1a01 in __throw () from /x86/lib/libcpp.so.2

Strange that it would unwiding in libcpp.so.2 - can you tell me
more about what you are doing?

The program links with couple other shared libraries. When I throw the
exception, it’s also unwiding within other shared libraries, and the debug
trace looks similar to above, except in different librarise. After I have
re-built others libraries with -lang-c++, it seems working alright for
now. (I hope)

Again, thanks a lot.


Any idea?

Thanks again
kc


Colin Burgess wrote:

Yes, you must make sure that you tell qcc that it is a C++ shared
object. Add -lang-c++ to your link line, and it will include the
correct startup files to register your exception regions.

Cheers,

Colin

kc <> kwlee@nortelnetworks.com> > wrote:
Hi All,

I am trying to throw an exception from within an shared library, but it
just simply aborts. I am never be able to catch the exception. Also, I
do include -fexceptions during the compilation on all object files.
Anything else I have missed?

Thanks in advance.
kc




\

Yes, you must build everything with -lang-c++

kc <kclee@netnobound.com> wrote:

Colin Burgess wrote:

kc <> kclee@netnobound.com> > wrote:
Hi Colin,

Just want to clarify a bit.
Is the -fexceptions necessary ?

You can use -lang-c++ or it will add -fexceptions automatically
if it is a .cc/.cpp/.C file

Do I add -lang-c++ to my link line when I build the shared library or the
problem?

Both.

It seems to me I need to include -lang-c++ during the compilation each
object file and in the link line when I am building either shared library or
program.


When I throw the exception within the shared library, my program hangs.
The following is debug trace…
#0 0xb03b26e8 in find_fde () from /x86/lib/libcpp.so.2
#1 0xb03b2e60 in __frame_state_for () from /x86/lib/libcpp.so.2
#2 0xb03b15ba in next_stack_level () from /x86/lib/libcpp.so.2
#3 0xb03b17e0 in throw_helper () from /x86/lib/libcpp.so.2
#4 0xb03b1a01 in __throw () from /x86/lib/libcpp.so.2

Strange that it would unwiding in libcpp.so.2 - can you tell me
more about what you are doing?


The program links with couple other shared libraries. When I throw the
exception, it’s also unwiding within other shared libraries, and the debug
trace looks similar to above, except in different librarise. After I have
re-built others libraries with -lang-c++, it seems working alright for
now. (I hope)

Again, thanks a lot.



Any idea?

Thanks again
kc


Colin Burgess wrote:

Yes, you must make sure that you tell qcc that it is a C++ shared
object. Add -lang-c++ to your link line, and it will include the
correct startup files to register your exception regions.

Cheers,

Colin

kc <> kwlee@nortelnetworks.com> > wrote:
Hi All,

I am trying to throw an exception from within an shared library, but it
just simply aborts. I am never be able to catch the exception. Also, I
do include -fexceptions during the compilation on all object files.
Anything else I have missed?

Thanks in advance.
kc





\


cburgess@qnx.com