如何确定OS X dylib是否与-flat_namespace链接

Jos*_*uer 3 macos xcode dylib dynamic-linking dyld

我有一个第三方OS X dylib,我正在我的应用程序中使用,并且无法轻松访问其创建者.我想确定它是否与-flat_namespace链接.那可能吗?如果是这样,怎么样?

Nic*_*ley 10

otool -hV在库上运行.如果你没有看到TWOLEVEL,那就是与之相关联的-flat-namespace.例如:

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
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)