`ldd' functionality

Gary V. Vaughan gvaughan@oranda.demon.co.uk
Tue Dec 8 14:57:00 GMT 1998


I am in the process of patching libtool to play nicely on win32, and
it turns out that as part of the port I need to do the equivalent to ldd
on linux/solaris.

Attached is a script which seems to give the right results -- is this
the correct approach?  Or is there a cleaner (or less kludgy) way to do
it?

Cheers,
	Gary V. Vaughan.
#! /bin/sh

object=$1
exeext=.exe
re_dll='^	DLL Name: '

test -f $object$exeext && object=$object$exeext
test -f $object || { echo "$object: no such file"; exit 1; }
test $# = 1 || { echo "USAGE: ldd <object>"; exit 1; }

OBJDUMP=${OBJDUMP=objdump}
OBJDUMP_FLAGS=${OBJDUMP_FLAGS='-p -j idata'}

eval ${OBJDUMP} ${OBJDUMP_FLAGS} $object \
	| grep "$re_dll"  | sed "s,$re_dll,,"

exit 0


More information about the Cygwin mailing list