本文介绍了如何确定OS X dylib是否与-flat_namespace链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

推荐答案

在库上运行otool -hV.如果看不到TWOLEVEL,则表明它已与-flat-namespace链接.例如:

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

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

这篇关于如何确定OS X dylib是否与-flat_namespace链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 07:01