I have never made a lib before. Just for fun, I quickly read the tut in MASM32, and said, "I don't think this is gonna work".

I have no procs in the lib, just code entry points like this:


_foo dd offset @foo
@foo:


Putting extern _foo:proc makes it available. Amazing.

So anyway here's a real question:

Do I still have the benefits of only the needed code being included in my exe, or should I wrap it in a proc?

I stepped into CreateWindowEx, and the whole lib was present?
Posted on 2002-07-02 13:30:48 by ThoughtCriminal
Only the necessary parts will be included - however (and this goes
for procs as well), as long as you reference *anything* from a .obj,
the whole obj gets included. Not like most C compilers that have
methods to split at function-level without producing a zillion objs :).
Posted on 2002-07-02 13:38:01 by f0dder
IIRC, you can build the lib in pieces - assembling each routine individually, and then link them together to get the level of granularity at the routine level. Hutch--, should be able to advise you, as that is how the MASM32 lib is built.
Posted on 2002-07-02 13:45:22 by bitRAKE
A .lib file allows you to put what would be several .obj files into a single file. As f0dder says, the linker pulls in necessary code in .obj chunks.

I haven't looked at what C++ compilers do to avoid generating multiple .obj files for each source file. For all I know, it may be a .lib file pretending to be a .obj file.
Posted on 2002-07-02 15:04:49 by tenkey
LIBs are cool for "functions" that you use all the time, like DWTOA in MASM32.LIB. I have a DTOAE that I use. It's like DWTOA, but inserts commas in the result. It could have been the first member of a new LIB. I've also got QTOAE that does the same thing with 64 bit numbers. It's also a member of the same LIB. If I use only one in a program, the linker includes only the one.

And I think the linker will look for the *.OBJ file, if it doesn't find it in the supplied LIBs. :)
Posted on 2002-07-02 16:52:39 by S/390
Hmmm, sounds like I just link several objs into a lib. And the granularity is controlled by what I put in each obj. So always realted functions, could go in one obj.
Posted on 2002-07-03 00:06:25 by ThoughtCriminal