如何获取dylib版本信息 [英] How to get dylib version information

查看:398
本文介绍了如何获取dylib版本信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我想获得dylib版本。我有一个dylib路径,我想获得版本号。

我已经尝试过otool -L命令并且它给了我正确的输出但是按照要求我不能使用它,因为我在目录中有100个dylib,我想获取版本信息,我不能通过NSTask和NSPipe为每个dylib运行otool命令。 />


我还找到了NSVersionOfLinkTimeLibrary()函数来获取dylib版本,但根据文档NSVersionOfLinkTimeLibrary返回链接库的版本号而不是其他dylib。



任何有关这方面的帮助都会有所帮助。



谢谢。

Omkar

Hello,

I wanted to get the dylib version. I''ve a dylib path for which I wanted to get the version number.
I''ve tried "otool -L" command and it''s giving me the proper output but as per the requirements I can''t use it, since I''ve 100 of dylib in a directory for which I wanted to get the version information and I can''t run "otool" command for each dylib through NSTask and NSPipe.

I''ve also found the NSVersionOfLinkTimeLibrary() function to get the dylib version, but as per the documentation NSVersionOfLinkTimeLibrary returns the version number for linked libraries and not for other dylib.

Any help on this would be helpful.

Thanks.
Omkar

推荐答案

您只想在大量文件上运行otool -L?



打开终端窗口并转到包含文件的目录,然后输入:



You just want to run "otool -L" on a large number of files?

Open up a terminal window and go to the directory containing the files, then type this:

for f in *
do
   otool -L


f
完成





OSX是基于unix的系统,terminal是一个unix shell,允许你运行unix脚本。



谷歌Unix shell脚本,以了解有关shell脚本的更多信息(如果我的解决方案的语法存在问题,也可以这样做 - 我没有'没有Unix机器来测试它。



OSX is a unix based system, and "terminal" is a unix shell that allows you to run unix scripts.

Google "Unix shell scripting" to find out more about shell scripting (also, do that if there is a problem with the syntax of my solution -- I didn''t have a Unix machine to test it on).


这篇关于如何获取dylib版本信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆