Project

General

Profile

Bug #950

Exception/shared objects bug

Added by Rogers, Chris over 11 years ago. Updated over 10 years ago.

Status:
Open
Priority:
Normal
Category:
Build System
Target version:
Start date:
21 March 2012
Due date:
% Done:

0%

Estimated time:
Workflow:
New Issue

Description

Alex, this was a bug that baffled me in, say MapCppSimulation. I wonder whether it still turns up now we have this API layer...

So let's say I throw an exception in, say, a function that resides in libMausCpp.so (or even an external shared libary), and try to catch it in, say _MapCppSimulation.so. The catch() in _MapCppSimulation.so does not recognise the Squeal as a Squeal. Take the example below:

////////// COMPILED INTO LIBMAUSCPP.SO /////////

#include "src/legacy/Interface/Squeal.hh" 

void foo() {
    throw Squeal(Squeal::recoverable, "Test exception", "foo");
}

I try to catch this in MapSomeMap.cc

////////// COMPILED INTO _MAPCPPSOMEMAP.SO /////////

#include "src/legacy/Interface/Squeal.hh" 

std::string MapCppSomeMap::process(std::string json_document) {
  try {
     foo();
  } catch (Squeal squee) {
     squee.Print();
  }
}

The Squeal doesn't get caught. In fact, the only way to catch these exceptions is to catch the std::exception base class. It looks like C++ doesn't understand the name Squeal because it is defined in an external shared object file! Have a look at this blog entry for example:

http://www.code-muse.com/blog/?p=58

So I tried changing compiler flags, in fact it didn't help. I also tried hacking around with some pragma as discussed here:

http://gcc.gnu.org/wiki/Visibility

But no cigar. So if you fancy something fun, maybe you could have a look?

#1

Updated by Rogers, Chris over 10 years ago

  • Assignee changed from Richards, Alexander to Rogers, Chris
#2

Updated by Rogers, Chris over 10 years ago

  • Assignee changed from Rogers, Chris to Rajaram, Durga

Also available in: Atom PDF