[BUG] dynamic_cast
fails on Mac because of missing visibility annotations
#1974
Labels
dynamic_cast
fails on Mac because of missing visibility annotations
#1974
Environment
Operating System: MacOS x64 12.7.6
Version / Commit SHA: VDB 12.0.0 (from
brew
)Other:
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Describe the bug
After loading a grid using
openvdb::io::Stream::getGrids()
, we're unable todynamic_cast
(it returns null) it to the typeopenvdb::FloatGrid
, despitetypeid(...).name()
reporting the same name for both.To Reproduce
Steps to reproduce the behavior:
-fvisibility=hidden
on a Mac.openvdb::io::Stream::getGrids()
then try todynamic_cast
it toopenvdb::FloatGrid
.typeid(openvdb::FloatGrid).name()
andtypeid(your_grid).name()
return the same string.Expected behavior
The
dynamic_cast
succeeds.Additional context
This bug is caused by the missing
__attribute__((__visibility__("default")))
annotation on your classes. Adding the annotation makes the cast pass.I added annotations to the following classes:
This is the type that
openvdb::FloatGrid
expands to, plus all its template arguments. I haven't tested if marking all those classes is necessary, but IIRC even the template arguments need to be marked.I'm not well-versed in openvdb, so I don't know if any other classes have the same issue or not.
The text was updated successfully, but these errors were encountered: