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

后端 未结 1 610
醉梦人生
醉梦人生 2021-01-03 08:55

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

相关标签:
1条回答
  • 2021-01-03 09:38

    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
    
    0 讨论(0)
提交回复
热议问题