News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

some lib.exe questions from a noob

Started by sasurfman, March 26, 2008, 04:05:29 PM

Previous topic - Next topic

sasurfman

when I execute lib.exe with the /list option on masm32.lib I get a list of object files which is what I expect, but when I execute the same command on any other .lib file I get a listing of a *.dll file name that just keeps repeating and sometimes I have to hit control C to stop the list.  I don't understand why this happens.  Can someone explain this?

Also, anytime I execute lib.exe the command prompt fails to return unless I hit the enter key.  For example: the command lib.exe /? gives me a list of usage options but the command prompt does not return after the listing is complete. It is like the command is expecting some kind of input.  I have to hit return to get the command prompt back. I don't understand why this happens either.

Any help would be appreciated.  Thanks.

Ossa

OK, I get both of those problems too.

As for the hanging at the end, there is a simple solution. lib.exe is not what actually does the work, it merely passes all of it's arguments to link.exe with a -lib switch, so instead of:

Quotelib /list masm32.lib

you can do

Quotelink -lib /list masm32.lib

I have no solution for the repeated ".dll" output.

As for a reason, perhaps this version of link.exe is somehow incompatible with lib.exe? and maybe they broke the /list code? I don't know... has this occurred with older versions? I've not tried it before, so I can't say whether this is a recent or older problem.

Ossa
Website (very old): ossa.the-wot.co.uk

MichaelW

AFAIK the difference is in whether the library is a static library or an import library. If you search the MASM32 lib directory for files matching "*.lib" that contain the text ".obj", you should get a list of the three static libraries in the directory:

masm32.lib
fpu.lib
debug.lib

You can use polib.exe to display the DLL exports in an import library, as well as the object modules in a static library.
eschew obfuscation

sasurfman

I tried using link with the -lib option.  That worked! Thanks.  Are all the "lib" functions available in link? If so why have lib.exe?

I used polib with the list option and indeed a list of exports(?) was produced for the file.  Can you tell me how or why link.exe will recognize the exported functions in an import.lib and link them correctly, but will not produce a correct listing for the same file?

Ossa

Quote from: sasurfman on March 28, 2008, 03:28:47 AM
I tried using link with the -lib option.  That worked! Thanks.  Are all the "lib" functions available in link? If so why have lib.exe?

Yes, they are all available. As I said, lib.exe doesn't actually do anything, it just copies the commandline arguments that you pass it and add pass them onto link.exe with the -lib switch. In fact it's worse than that, the buffer lib.exe has for a commandline is 256 bytes (IIRC), which limits arguments to lib.exe in the commandline to that. However link.exe has no limit on the commandline length (that I've seen so far anyway). Therefore I always use the link.exe -lib version.

It's probably there for backwards compatibility.

Quote from: sasurfman on March 28, 2008, 03:28:47 AM
I used polib with the list option and indeed a list of exports(?) was produced for the file.  Can you tell me how or why link.exe will recognize the exported functions in an import.lib and link them correctly, but will not produce a correct listing for the same file?

What exactly are you trying to get out of the .lib file? Perhaps you should be looking at dumpbin.exe (which also calls link.exe, but with the the switch "-dump").

Ossa
Website (very old): ossa.the-wot.co.uk

sasurfman

Quote from: Ossa on March 28, 2008, 07:32:34 AM

What exactly are you trying to get out of the .lib file? Perhaps you should be looking at dumpbin.exe (which also calls link.exe, but with the the switch "-dump").

Well (ahem), actually I was just trying to see what object modules were contained in the various .lib files, not realizing that import libraries and objects file libraries had the same file extension. That is why the repeating *.dll file name that was listed was confusing me.  I didn't understand how a *.dll could be in an object file library.

Another thing that is confusing me is the ms documentation.  It seems that all of the docs, ie. Programmer's reference,  apply to the older 16 bit versions, and that there is no documentation for the newer 32 bit versions. The switches are different for one thing. Another thing is that I am studying "Introduction to 80x86 Assembly Language and Computer Architecture" by Detmer and he uses (includes) .h files in his source file but the ms docs talk about .inc files being included.  The docs don't say anything about C type include files being used by masm.  Things like this  confuse me.

MichaelW

There is quite a lot of recent information available here. Also look under C/C++ Build Tool further down the tree in the left panel (reload the page if necessary to see the tree).

You can get the command line syntax and a minimal listing of the options for most MS tools by passing /?, for example:

ML /?
LINK /?
LIB /?

MASM does not care what extension an include file has, INC is just a convention. You also commonly see ASM used.
eschew obfuscation