Dynamic cast failing in dynamically loaded plugin on os x 10.6
Dynamic cast failing in dynamically loaded plugin on os x 10.6
- Subject: Dynamic cast failing in dynamically loaded plugin on os x 10.6
- From: john haddon <email@hidden>
- Date: Tue, 27 Oct 2009 06:03:41 +0000
- Importance: Normal
Hi,I'm running into an issue whereby a dynamic_cast fails on os x 10.6, apparently due to duplicate type_info symbols. I originally had this problem with a python module (which previously worked well on Leopard and Tiger) but have now distilled it down into a simple standalone test case which still fails. The test case has a dylib which defines a class Base and a templated subclass Derived. The library is then linked by a plugin which calls a library function to return a new instance of Derived via a Base *. The plugin then attempts to dynamic_cast the Base * to a Derived *, but fails. There's also an executable which loads the plugin and runs the test - the executable itself does not link with the library.
The failing test can be found here : http://johnhaddon.fatcow.com/stuff/rttiProblem.tar.gz. This contains a simple shell script to build the test, and the test can then be run by running Executable. Success is denoted by no output - failures are denoted by failing asserts.
The only way I've managed to get this to work is by setting MACOSX_DEPLOYMENT_TARGET to 10.4 at the point of compilation, whereby everything works as expected. This makes me suspect that the problem may be due to the new fast weak symbol coalescing described here http://developer.apple.com/mac/library/releasenotes/DeveloperTools/RN-dyld/index.html#//apple_ref/doc/uid/TP40001695-SW5. Does that seem plausible? Is there a better fix than setting MACOSX_DEPLOYMENT_TARGET?
Thanks in advance for any insight you can provide... Cheers... John
Ready…Set…Get a great deal on Windows 7 See phenomenal deals on Windows 7 now
|
_______________________________________________
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