When I am programming, why is it that my files get several K bigger evey time I include one little win32 api call, isn't most of the work supposed to be contained in my dlls?

Besides using loadlibrary functions, is there other ways of compacking my code?
Posted on 2002-09-08 21:10:58 by zenwaters
You could use a compression programm like UPX.
Posted on 2002-09-09 00:55:14 by bazik
Yes but "several KB's for each API call" will be a challenge even for UPX. :grin:
Posted on 2002-09-09 03:30:52 by Maverick
You can squeeze some VB apps to a 10th of their size with UPX ;)
Posted on 2002-09-09 03:48:24 by bazik
Yes, I know Markus Oberhumer's UPX and the NRV compression that it uses. ;)

I was just joking on the original poster's affirmation that his EXE's grow of "several KB's for each API call" that he includes. :)
Posted on 2002-09-09 03:56:01 by Maverick
your question lacks logic, if you think about it you will see why. When you call "little" API calls, are you including more lib and inc files to make that api call possible? Or maybe you have to do some parameter setups before calling that API?

When you make an API call, the call itself uses 10's of bytes, *not* 1000's of bytes. If it is using K's of bytes, then you are either doing lots of prepatory work, or you are doing something wrong.....
Posted on 2002-09-09 06:12:45 by sluggy

I agree with Sluggy here, API calls only increase your code size by a few bytes at a time, push/call instruction size etc ....

If you can give us some idea of what you are doing or paste in a small amount of your code, maybe someone can help you track down the problem.


Posted on 2002-09-09 07:42:25 by hutch--
Afternoon, zenwaters.

The only way your proggys would increase in size by a few kbs each time you included an API call, is if you were actually using a static lib. Anything from the user32/kernal32/etc32 libs won't increase the size of your proggys dramatically.

I can only think of two ways inwhich your proggy is increasing in size.
1) you are using a static lib (i.e. like d3dx8.lib).
2) You're actually adding buffers/structs in your .data section for use with these APIs.

What're the libs you're including in your proggy? We'd be able to give you a more accurate assessment of what's happening, if we knew;).

Posted on 2002-09-09 08:04:50 by Scronty
My apolgoies all -

I seem to have made a mistake here, sorry... what I thought was happening wasn't when I looked at it a second time.

For some reason I thought when I compiled my PE .exe file it got signifigantly bigger with each .dll call that I added into my source, but that's not the case... I looked at it again, with one api call my .exe was 16k. If I add another, it is still 16k, and another, still 16k.

Sorry for the confusion, thanks for your willingness to help! :alright:
Posted on 2002-09-09 20:50:07 by zenwaters

If you initial size is 16k, it sounds like you are using one of the C/C++ linkers that is aligned differently, try using the linker from MASM32 that is from the win98ddk, it will drop your file size a lot as it uses alignment suitable for VxD files.

You can also look up the options on a C/C++ linker to change the alignment to get the size down.


Posted on 2002-09-09 22:30:53 by hutch--
I rather think he made the typical "newbie" mistake and used only initialized buffers ;)
Posted on 2002-09-10 00:50:28 by bazik