The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: scolby33 on August 27, 2009, 03:54:49 AM

Title: Includes and Libraries
Post by: scolby33 on August 27, 2009, 03:54:49 AM
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.
Title: Re: Includes and Libraries
Post by: dedndave on August 27, 2009, 04:03:18 AM
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/
Title: Re: Includes and Libraries
Post by: dedndave on August 27, 2009, 04:28:09 AM
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
Title: Re: Includes and Libraries
Post by: Thomas_1110 on August 27, 2009, 01:22:31 PM
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?
Title: Re: Includes and Libraries
Post by: dedndave on August 27, 2009, 01:42:19 PM
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
Title: Re: Includes and Libraries
Post by: scolby33 on August 27, 2009, 04:09:57 PM
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)?
Title: Re: Includes and Libraries
Post by: Slugsnack on August 27, 2009, 05:17:02 PM
yes that is the basic idea of equates. also good for constants and stuff for functions, even function names, etc.
Title: Re: Includes and Libraries
Post by: dedndave on August 27, 2009, 05:37:24 PM
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
Title: Re: Includes and Libraries
Post by: Vortex on August 27, 2009, 05:41:37 PM
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