How to determine if an OS X dylib was linked with -flat_namespace

风格不统一 提交于 2019-12-18 17:57:02

问题


I have a third party OS X dylib that I'm using in my app and don't have easy access to its creator. I'd like to determine if it was linked with -flat_namespace. Is that possible? If so, how?


回答1:


Run otool -hV on the library. If you don't see TWOLEVEL, then it was linked with -flat-namespace. For example:

twolevel.dylib:
Mach header
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
MH_MAGIC_64  X86_64        ALL  0x00       DYLIB     8        672   NOUNDEFS DYLDLINK TWOLEVEL NO_REEXPORTED_DYLIBS

versus

flat.dylib:
Mach header
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
MH_MAGIC_64  X86_64        ALL  0x00       DYLIB     8        672 DYLDLINK NO_REEXPORTED_DYLIBS


来源:https://stackoverflow.com/questions/2553530/how-to-determine-if-an-os-x-dylib-was-linked-with-flat-namespace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!