News:

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

Includes and Libraries

Started by scolby33, August 27, 2009, 03:54:49 AM

Previous topic - Next topic

scolby33

I have been googling for about half an hour, and I cant find anything, so...

What exactly are .inc files and .lib files? What are they for? How do they work?

I know that the .inc's specify prototypes for the invoke directive, and that .lib's relate 1-to-1 with DLL's. I do not understand what all the equates in the .inc's are for, and why one needs .lib's anyway. How do .inc's relate to the .h flies supplied with Microsoft's SDK? And how do the macros and the masm library relate to this?

I hope these are not too many questions, but I am on a quest to understand assembly.

dedndave

include files just "insert" whatever text is in them into your program file, as though they were part of the file
you can include macros and procedures, as well as prototypes and equates like the masm32 inc's
static libraries are usually collections of assembled/compiled OBJ's
if you draw upon a static library, the code becomes part of your program
you can create your own libraries
you can even look inside LIB files and see what's in them
Erol (Vortex) has many tools on his site for working with libraries, etc
http://www.vortex.masmcode.com/

dedndave

also, for LIB files, here is the reference for LINK...
http://msdn.microsoft.com/en-us/library/aa270751(VS.60).aspx
and for the LIB extension...
http://msdn.microsoft.com/en-us/library/aa295786(VS.60).aspx
on the left there are a few good catagories
managing a library
extracting a library member
working with imports

for dynamic load libraries (dll's)...
\masm32\tutorial\dlltute

Thomas_1110

Hello
Quoteyou can even look inside LIB files and see what's in them
whats the name of the program to look inside a LIB file?

dedndave

LIB.EXE is an extension of the linker...
Quotehttp://msdn.microsoft.com/en-us/library/aa295786(VS.60).aspx

on the left there are a few good catagories
managing a library
extracting a library member
working with imports

scolby33

Thanks. I need to remember to look in MSDN first...
Are equates just aliases to make it easier to read the code (i.e. true=1)?

Slugsnack

yes that is the basic idea of equates. also good for constants and stuff for functions, even function names, etc.

dedndave

Quotetrue=1
that bugs me a little - lol
of course, "true" is any non-zero value
but, if you want to apply bit-wise boolean algebra, a better way is...

FALSE   EQU     0
TRUE    EQU     NOT FALSE

which yields -1 as the value for true

Vortex

Hi scolby33,

You can use WJR's PEview to study the internals of libraries :

http://www.magma.ca/~wjr/PEview.zip

Website :

http://www.magma.ca/~wjr