terminate called after throwing an exception from a shared library

Matthias Kretz kretz@fias.uni-frankfurt.de
Sat May 15 14:37:00 GMT 2010


Hi,

On Saturday 15 May 2010 06:28:58 Dallas Clement wrote:
> terminate called after throwing an instance of
> 'Execution::TEventHandle<Execution::EventBody>'

I guess there is a local symbol of this type in both lib B and the executable. 
As it happens often with templates you define Execution::TEventHandle only in 
a header of lib A and the specialization 
Execution::TEventHandle<Execution::EventBody> then gets instantiated in lib B 
and the executable.

Check your libs and executable with "nm -C" for (I think) typeinfo for 
Execution::TEventHandle<Execution::EventBody>

If this symbol is only defined in one DSO and undefined in the others it 
should work. Else they use their own local symbol and thus seemingly a 
different type.

You can fix this issue by doing an explicit specialization in lib A and moving 
at least one function of TEventHandle out of the header into a .cpp file of 
lib A. (AFAIR -- it's been a long time since I messed with errors of this 
kind.)

Regards,
	Matthias



More information about the Gcc-help mailing list