Subject: Re: `ldd' functionality
From: [email-masked] (Mumit Khan)

10 Dec 1998 05:46:41 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
To: "Gary V. Vaughan" <[email-masked]>
Cc: [email-masked]

On Wed, 9 Dec 1998, Gary V. Vaughan wrote:

> Ahh.. I didn't know dll's could depend on one another.  Are these
> dependencies encoded into the dependee by cygwin's ld at linktime?

It's the same as on other Unix systems, where shared libraries can have
dependencies as well (the win32 dll architecture is of various quite
different from the various flavors of Unix shlibs, but it's the same 
basic idea). One glaring difference is that the win32 shlibs must be 
able to resolve all symbols at link time (as opposed to 8 load time). 

The dependencies are encoded in the PE header.

> libtool is currently one (or three) big shell scripts, so I want to
> avoid compiling a program if I can.  I have attached an even uglier
> script which does the recursion and displays a bit more info.  Am
> I doing the right thing now?

I took a quick look, and it seems to be almost there.

Few comments (please note that this is from just perusing the code, so 
I may be way off, in which case apologies in advance):

- absolute pathname may not work as is (eg., ``ldd /bin/sh.exe'')

- You do need to sort out duplicates (eg., if MSVCRT.DLL is a dependency 
  for multiple DLLs on the list, it'll be listed multiple times). I'm 
  sure a quick sort and uniq will fix that.

- the path search is confusing. for example, let's say I have a file
  called foo.exe in my current working directory (which is not in my
  path), and a file called foo.exe in my PATH. Now if I do:
    
    $ ldd foo.exe
  
  it picks up the one in the PATH instead of the one in the current
  directory! Hope I read the algorithm correctly -- don't have a windows
  machine to test it out.

  You *may* need to extend the search path to include the default search 
  path for win32 DLLs (different for win9x and NT), including the 
  directory containing executable as well as the current working directory. 

Regards,
Mumit

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".