2

My problem is the following:

There is a shared library called Interface.so which is based on ICE (Internet Communication Engine) and something like a wrapper for frequently recurring tasks. One of these tasks is to register for a topic (similar to an id). In case, this topic does not exist already, ICE throws an exception called NoSuchTopic.

If I use Interface.so with a stand-alone Qt application it is possible for me to catch the NoSuchTopic exception and create the topic in the catch block (the catch block resides in Interface.so). But I want to do the same in a plugin for a flight simulator, which is itself a shared object - and here the exception is not caught by the previous mentioned catch block in Interface.so. Instead, the flight simulator crashes stating

 terminate called after throwing an instance of 'IceStorm::NoSuchTopic' 

nm -C -D says that 'IceStorm::NoSuchTopic' is undefined in Interface.so. Is this ok? Or should there be a reference where to find the definition? I already added the entry for libIceStorm.so (libs += -lIceStorm) where IceStorm::NoSuchTopic is defined (according to nm) but that does not change anything!

I also tried '-Wl,-E' but I don't know if I set this option correctly in Qt Creator. Would this help at all?

I would be grateful for every hint.

Markus
  • 21
  • 2

2 Answers2

1

When I've had this problem before it is usually due to type information not being available.

You can often catch the exception with a try {} catch (...) {} block as that catches exceptions even when type info is missing, but it isn't particularly useful!

This is often a problem if the shared library has had symbols hidden, see the GCC Visibility article, especially the "Problems with C++ exceptions (please read!)" section.

This question recommends the use of the extra flags.

Sometimes a clean-rebuild will fix things if something is built against an old version of the library. If a clean-rebuild fixes the problem, check your build script is correct.

Community
  • 1
  • 1
Silas Parker
  • 8,017
  • 1
  • 28
  • 43
  • Thanks for your answer. Unfortunately I had tried every suggestion before posting here (my "-Wl,-E" came from the linked answer). However, finally my colleague solved the problem. Apparently the GCC version used for ICE in the Ubuntu repository is different to the Ubuntu 11.10 Default GCC, so the problem was solved by recompiling ICE from source... – Markus Jan 18 '12 at 20:58
0

Sounds like the previous version used the "no-exceptions" flag when building from source. It adds a lot of time to the build so a lot of people leave it off.

Rachael
  • 1,965
  • 4
  • 29
  • 55