• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[solved] Re: Exceptions between DSOs not working, how to find cause?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[solved] Re: Exceptions between DSOs not working, how to find cause?


  • Subject: [solved] Re: Exceptions between DSOs not working, how to find cause?
  • From: Mario Emmenlauer <email@hidden>
  • Date: Tue, 24 Nov 2009 08:23:54 +0100



Mario Emmenlauer wrote:
Mario Emmenlauer wrote:
Mario Emmenlauer wrote:
before waisting someones time: I know this has been asked before
and I (think I) know the solution, i.e. a good starting point was
http://lists.apple.com/archives/Xcode-users/2006/Jul/msg00400.html

My problem: when I throw an exception from a dll, I can not catch
it in other static libraries - I can only 'catch (...)'.

Stated in the link above, typical problems are:
 - It doesn't work properly if your code doesn't obey the one definition
   rule: http://en.wikipedia.org/wiki/One_Definition_Rule
 - Your DSOs need to export all their symbols

I have added '-fvisibility=default' to CFLAGS, and explicitly set
'__attribute__((visibility("default")))' in the declaration of the
exception class. So the problem must be the ODR?

Same after adding -shared-libgcc to linker and compiler flags. Same behavior with gcc-4.2.1.


We have a gigantic codebase, is there a way I can (simply) find if
ODR is violated? Can I look up the symbol of the Exception class
manually?

Finally, I found the problem. We have the exception class defined in a static library. This library gets linked into our DSOs, so the exception class is available with a different address in multiple DSOs. Since gcc uses the address to compare typeinfo, the exceptions can not be identified :-(

The solution probably is to have the exceptions defined in a
DSO, not a static library.

All the best,

   Mario



gcc-4.0.1
MacOS 10.6.2
compiled from qmake-generated Makefiles

Thanks for all help,

Mario

_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Exceptions between DSOs not working, how to find cause? (From: Mario Emmenlauer <email@hidden>)
 >Re: Exceptions between DSOs not working, how to find cause? (From: Mario Emmenlauer <email@hidden>)
 >Re: Exceptions between DSOs not working, how to find cause? (From: Mario Emmenlauer <email@hidden>)

  • Prev by Date: Re: Library not loaded: Main App finds private framework but helpers can't
  • Next by Date: XCode’s Documentation Complains “File Not Found” but Gives Correct Results
  • Previous by thread: Re: Exceptions between DSOs not working, how to find cause?
  • Next by thread: Assembler directive?
  • Index(es):
    • Date
    • Thread