News:

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

Amount of object code included when using lib

Started by Gunnar Vestergaard, August 19, 2009, 01:30:03 PM

Previous topic - Next topic

Gunnar Vestergaard

Forgive me, as this is a newbie question.

If I intend to use fpu.lib from \masm32\lib
using
include \masm32\include\Fpu.inc
includelib \masm32\lib\Fpu.lib

How much will my application's byte size grow when including that library? I mean, does object size depend on the number of fpu.lib functions actually used? Or is the entire library included with all functions, even functions that I don't use?

Is fpu.lib called a static library? I think that I have to read more in the documentation that is supplied with MASM32.

The last time I read the IA-32 docs from Intel, I understood that the Pentium cpu does not have native instruction support for asin(), but sin() is supported as a mnemonic. So where is asin() implemented when used in MASM32?

dedndave

it should only pull in the functions that you use, plus any that may be required to perform those functions
let's say we have a library with 4 functions:
#1 - a "low level" function
#2 - a second "low level" function
#3 - a "high level" function that calls function #1
#4 - a "high level" function that calls function #2

if your program uses only function #3, functions #1 and #3 will be pulled in - not #2 or #4
if your program uses functions #2 and #3, functions #1, #2, and #3 will be pulled in - not #4


MichaelW

Fpu.lib is a static library that appears to have been created from multiple object modules, one per function, so the object code for the functions will be added to the EXE just as Dave described. If the library had been created from a single object module that contained all of the functions, then calling any of the functions would have pulled in the object code for all of the functions. My test EXE was initially 2560 bytes. After the "includelib \masm32\fpulib\fpu.lib" statement was added the EXE was still at 2560 bytes. Adding a call to FpuAtoFL increased the EXE size to 3072 bytes, and adding a call to FpuMul increased it to 3584 bytes.
eschew obfuscation

raymond

QuoteSo where is asin() implemented when used in MASM32?

That particular one would be implemented by calling the FpuArcsin function.
Look at the list of FpuArcxxx functions for the other inverse trig functions.
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com