OpenUSD
OpenUSD copied to clipboard
Workaround issue 1475 by comparing types by name
The default implementation of operator== for typeinfo objects in Appple's libc++ relies on typeinfos for the same type in different DSOs being merged. For this to happen, USD classes have to be marked with default visibility. USD doesn't have visibility set on core classes, which makes the RTTI machinery, on which classes such as VtArray rely, fail at runtime and compare typeinfos for the same type from different DSOs as different. This can be worked around by explicitly comparing the types by name.
Disclaimer: I am currently employed by Chaos (formerly Chaos Group). My employer does not claim ownership of my open-source contributions and I have explicit permission to submit this pull request as an individual contributor.
Description of Change(s)
Changed TfSafeTypeCompare to compare types by name, so it works when USD is used in DSOs compiled with -fvisibility=hidden.
Fixes Issue(s)
- 1475 (not a proper fix, just a workaround)