User Name
Password
AppleNova Forums » Programmer's Nook »

Dependency Walker for Mac libraries


Register Members List Calendar Search FAQ Posting Guidelines
Dependency Walker for Mac libraries
Thread Tools
kate
Member
 
Join Date: Jan 2006
 
2006-08-23, 03:24

Hi,
Is there any free utility that scans dynamic libraries (dylib) and builds a hierarchical tree diagram of all dependent modules.
In Windows there is a utility called Dependency walker http://www.dependencywalker.com/
I want similar utility on Mac.
Thank you.
  quote
kate
Member
 
Join Date: Jan 2006
 
2006-08-24, 03:32

I found solution to my question.
CODE:
#!/usr/bin/env ruby

paths = [ARGV[0]]
libs = { ARGV[0] => 1 }

while paths.size > 0 do
path = paths.pop
lines = `otool -L '#{path}'`.split("\n")[2..-1]
new_libs = lines.collect do |line|
line =~ /\s+(.*)\s+\(.*\)\s*/
$1
end
new_libs.each do |lib|
if libs[lib] then
libs[lib] += 1
else
libs[lib] = 1
paths << lib
end
end
end

puts libs.keys.sort.join("\n")

1. Put it in a file called libdepend.rb
2. Terminal:
Make it executable with chmod +x libdepend.rb, and
Run it:
./libdepend.rb /usr/lib/libxslt.dylib

Thank you.
  quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Post Reply

Forum Jump
Thread Tools
Similar Threads
Thread Thread Starter Forum Replies Last Post
Partial iPhoto and iTunes libraries? chucker Genius Bar 2 2006-05-24 14:21
Merging iTunes Libraries Bryson Genius Bar 3 2005-06-08 02:24
Dual itunes Music libraries Leafeaterx Genius Bar 5 2004-07-14 04:04


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 00:57.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2024, AppleNova