Turns out CoreUI.framework has its own implementation of the BOM* functions which are NOT exported.
% nm -a /System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/CoreUI | grep BOM
...
00007fff4228e697 t _BOMTreeIteratorFree
00007fff4228dcf1 t _BOMTreeIteratorIsAtEnd
00007fff4228dd45 t _BOMTreeIteratorKey
00007fff42290791 t _BOMTreeIteratorKeySize
00007fff4228d819 t _BOMTreeIteratorNew
...
In order to get _enumerateFacets working, we only need the CoreUI variants of BOMTreeIteratorNew and BOMTreeIteratorFree.
With these functions being not visible to the linker or dlsym, they have to be resolved manually during runtime. I was able to do this with my libSymRez project like so:
symrez_t sr_coreui = symrez_new("CoreUI");
BOMTreeIteratorRef (*CUIBOMTreeIteratorNew)(BOMTreeRef, int, int, int) = sr_resolve_symbol(sr_coreui, "_BOMTreeIteratorNew");
void (*CUIBOMTreeIteratorFree)(BOMTreeIteratorRef) = sr_resolve_symbol(sr_coreui, "_BOMTreeIteratorFree");
Then replace the functions:
-- BOMTreeIteratorRef iterator = BOMTreeIteratorNew(facet_tree, 0, 0, 0);
++ BOMTreeIteratorRef iterator = CUIBOMTreeIteratorNew(facet_tree, 0, 0, 0);
...
-- BOMTreeIteratorFree(iterator);
++ CUIBOMTreeIteratorFree(iterator);
And we are back in business. It would probably be best to replace all BOM related functions with their CoreUI counterparts but this gets us going.
No idea why _enumerateColors works but _enumerateFacets doesn't.
Turns out CoreUI.framework has its own implementation of the
BOM*functions which are NOT exported.In order to get
_enumerateFacetsworking, we only need the CoreUI variants ofBOMTreeIteratorNewandBOMTreeIteratorFree.With these functions being not visible to the linker or
dlsym, they have to be resolved manually during runtime. I was able to do this with my libSymRez project like so:Then replace the functions:
And we are back in business. It would probably be best to replace all BOM related functions with their CoreUI counterparts but this gets us going.
No idea why
_enumerateColorsworks but_enumerateFacetsdoesn't.