Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - Throw exception from shared object.: (4 Items)
   
Throw exception from shared object.  
Hello,

I try to throw a C++ exception from a function located in a shared lib and catch it from my main thread.
But the only thing I get is a "core dumped" ...

my compiler version : 3.3.1 and my QNX core version :  6.3.0

Did anyone do  the same stuff ?

Thanks



RE: Throw exception from shared object.  
To this all the time and works fine, but I`m not using 6.3.0.

Did you add the compiler option to support exception,when building the shared lib and program?

> -----Message d'origine-----
> De : Philippe ELSKENS [mailto:community-noreply@qnx.com]
> Envoyé : 6 octobre 2011 10:26
> À : general-toolchain
> Objet : Throw exception from shared object.
> 
> Hello,
> 
> I try to throw a C++ exception from a function located in a shared lib and
> catch it from my main thread.
> But the only thing I get is a "core dumped" ...
> 
> my compiler version : 3.3.1 and my QNX core version :  6.3.0
> 
> Did anyone do  the same stuff ?
> 
> Thanks
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post89245
> 
Re: RE: Throw exception from shared object.  
Thanks you Mario for your answer.
I don't know what kind of options are needed to use C++ exceptions in a shared lib.
I've tried -fexceptions but it seems that options is just need for C functions to work  with mixed C++.

Re: RE: Throw exception from shared object.  
It seems  the problem was : I linked my shared lib with qcc and not with QCC.

Some of my file are c file and other are c++ files. I always use qcc and it selects the good compiler with the extension
 of the files (c or cpp ). 
 
But the problem appears  when I make the dynamic lib with the object files collection.
    
before (I get Abort and core dumped ) :

qcc -o mylib.so obj1.o obj2.o ....

now (it works fine):

QCC -o mylib.so obj1 obj2.o 

Voilà.