1
votes

I have the problem described here:

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

Exception class exported from shared library cannot be caught when used outside of the library, and the program terminates. I added __attribute__((visibility("default"))) to the class declaration:

class  __attribute__((visibility("default"))) MyException
{
    ...
};

But this doesn't help. Client executable does not catch this exception. gcc version is 4.4.1, used in the Linux OS.

1
If more than one linked object has a MyException, it must be visible in all of them, not just the one(s) that throw it --- any hidden definitions will override any default-visible ones.James
Sorry, don't not understand what you mean.Alex F
Actually, I am not sure that the problem is visibility. There is something else, which prevents the client to catch this exception, and it is GCC-specific. The same code runs successfully under MSVC. Runtime error looks like this: terminate called after throwing an instance of 'MyException'Alex F

1 Answers

0
votes

For future reference: this was not visibility problem. I got an answer here: Exceptions are not caught in GCC program