Looking into a static library

Looking into a static library

Bild des Benutzers dboggs

I have acquired various name.lib files, and I know they are static library projects built by Visual Studio Shell that came with various IVF (and CVF) applications over the years. I know that they contain various name.obj files, and I know that if I include all of the libs with my project that I can then call any of a whole bunch of name.obj subroutines. But how can I determine what obj files are in each lib?

In the old DOS days we built static libs using the LIB.EXE program, which had a simple (command-line) option to list the contents of a lib file.The only LIB.EXE program on my computer is version 3.15 (c) 1989, so it doesn't work well!

The only info I can find on line is that LIB still exists and is packaged with Visual Studio. But perhaps not the VS shell that we get with IVF? And if it is there, how do I use it?

9 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers Steve Lionel (Intel)

What you want is the "dumpbin" utility, which is provided. It's actually a wrapper around link, as is lib (which is also provided.

dumpbin /symbols

is the command I use most often - this tells you the symbols this library defines and uses. It is verbose so I suggest you redirect it to a file. You will need to open a "Fortran Command Prompt" window to use this.

If you just want to know which object files are in a library, use lib /list - just like on VMS.

Steve
Bild des Benutzers mecej4

You can filter the output of "dumpbin /symbols" to concentrate on the types of symbols that you wish to see. For example, to list only subroutine and function names, do

     dumpbin /symbols mylib.lib | findstr "SECT1.*External"

Bild des Benutzers dboggs

Thanks, I've got it now! The key was "Open a Fortran command prompt". I never would have guessed this was needed to run the LIB program, or even how to open that command prompt window in the first place. (For the benefit of the record and others who might be following this thread, you have to begin with the Windows Start button and select Intel Parallel Studio XE 201x > Command Prompt > SomethingFurtherThatIsNotClearToMeYet). What opens LOOKS like a regular command prompt window, but it's different, and I don't know how else to open it.

Bild des Benutzers app4619

I think the main difference for the "fortran command prompt" is that it sets a load on environmental variables. I think there is a batch file that can be run (or there used to be in times past) that can be used to set the vars

Bild des Benutzers app4619

I just check it runs:

C:\Windows\SysWOW64\cmd.exe /E:ON /V:ON /K ""C:\Program Files (x86)\Intel\Composer XE 2011 SP1\bin\ipsxe-comp-vars.bat" ia32 vs2010"

for 32bit and for 64 bit .....

C:\Windows\SysWOW64\cmd.exe /E:ON /V:ON /K ""C:\Program Files (x86)\Intel\Composer XE 2011 SP1\bin\ipsxe-comp-vars.bat" intel64 vs2010"

Bild des Benutzers Steve Lionel (Intel)

Yes - this is the same .bat file you can run from a regular prompt. You can also use ifortvars.bat. See the documentation for how to use the command line for accessing the compiler and tools.

Steve
Bild des Benutzers dboggs

Thanks everyone for the help.

I can now use LIB even though I don't understand it (my computer doesn't have the directories or the batch files you reference). I will let it go at that.

I long for the "good ole days" when all I needed was a LIB.EXE file, I put it anywhere I want it, run LIB mylibfile /LIST, and that was all it took. Why can't it be like this now?

Bild des Benutzers Steve Lionel (Intel)

 It is like that. You just have to have LIB on your PATH so that Windows can find it.  Yes, your computer does have the directories and batch files, though yours may not have the "ipsxe" version. Just use ifortvars.bat instead.

Steve

Melden Sie sich an, um einen Kommentar zu hinterlassen.