Hi,

At Wed, 26 Oct 2005 13:47:03 +0900,
Daniel Berger wrote in [ruby-talk:162672]:
> > > # Create a .def file from the results of a 'link -dump -exports'
> >
> > Actually, it calls dumpbin.exe.
> 
> My research indicates that older compilers use dumpbin.exe, but the
> more recent ones just use 'link -dump'.  I don't have dumpbin.exe on my
> machine for example, but I do have link.exe.

What version do you have?

With VC++2003, 'link.exe -dump' shows dumpbin.exe's message.

  Microsoft (R) COFF Binary File Dumper Version 6.00.8447
  Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

  usage: DUMPBIN [options] [files]

and putting -exports option before -dump, i.e., 'link.exe
-exports -dump' errs.

  LINK : warning LNK4044: unrecognized option '/exports'; ignored
  LINK : warning LNK4044: unrecognized option '/dump'; ignored

> Perhaps it has something to do with the version of lib.exe I have at
> work, because I had to download it off the web.  For whatever reason,
> the most recent versions of the free compiler from MS don't seem to
> include lib.exe by default any more.  That, or I messed something up.
> I *do* have it on my older laptop, but not on my desktop, for example
> (which has a more recent version).

Packaging miss?  Also, msvcrt.lib was lost in VC++2003.

> Cool, but you're going to have to make a check to see if dumpbin exists
> and use  link -dump instead if it doesn't.

Like this?

  if path = ENV["PATH"]
    path = path.split(File::PATH_SEPARATOR)
  else
    path = %w[.]
  end
  dumpbin = "dumpbin.exe"
  unless path.find {|dir| File.join(dir, dumpbin)}
    dumpbin = "link.exe -dump"
  end

  IO.foreach("|#{dumpbin} -symbols -exports " + objs.join(' ')) do |l|
    ...
  end

-- 
Nobu Nakada