Tiny C startup module to build smaller C executables

Started by Vortex, December 25, 2004, 02:36:17 PM

Previous topic - Next topic

Ehtyar

And maybe it just wasn't funny. *shrugs* Whatever floats your boat i guess, i just find it rather distasteful to directly contradict someone's request.

Ehtyar.

sinsi

And I find calling people "retards" offensive...oh well
Light travels faster than sound, that's why some people seem bright until you hear them.

Ehtyar

I'll finish up now before i say something I'll regret later. Hutch, perhaps you have given some thought to a C forum?...

Night all, Ehtyar.

hutch--

Ehtyar,

All I did with the vctoolkit was to put the default C/C++ libraries and platformsdk libraries into the same LIB directory. The same with all of the includes into the include directory. From the errors you are getting it looks like you may not have the default C/C++ libraries available to your build.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Ehtyar

#34
Well i am at a loss. The include lib and bin paths contain the vctoolkit, the 2003 SDK and the Vista SDK, and i have also tried using each individually with various results, none of which was success. Am i out of options?

Ehtyar.

[edit]
Seems I'm the only person on the planet with this problem, and no matter what i do, the errors return. I will try transferring all this to another machine soon, but till then, I'm out, bye all.
[/edit]

[edit2]
Well this is rather embarrassing, one of my batch files contained fully qualified paths for the lib, bin and include paths, so i had been using the wrong directory the entire time. Sorry to have wasted your time like that gents :(

Ehtyar.
[/edit2]

Ehtyar

Sorry that it's taken me so long to get back to this topic, but i have made further advancements on this topic.
It seems iostream is a bone of great contention among c++ compilers as it contains most of the standard c++ functionality in itself alone. It seems that using certain defines helps your compiler decide what is necessary to include from iostream, and what is not.
I have used the following defines to shrink that 50k app to only 8k, a far more acceptable size for a program of such limited functionality. Naturally you could do it in MASM in about 2k, but that's the price one pays for using hlls right? ;)
#define WIN32
#define _CONSOLE
#define NDEBUG
These can be defined on the command line at compile time to make things easier: cl.exe /D "WIN32" /D "NDEBUG" /D "_CONSOLE" <....> mylittleprogram.cpp.
Of course, if you're creating a GUI application, simply switch _CONSOLE to _WINDOWS :)

Hope this helps, Ehtyar.

Vortex

Here is an example of building a small C executable with Vista SDK. Depending on your Vista SDK installation, you need to modify Variables.cmd and SetVars.bat to reflect the correct paths.

[attachment deleted by admin]

GregL

Thanks for the example Vortex. It's interesting.


Vortex

New version of the tiny C run-time startup library :

The NULL terminator character of the last command-line argument was not copied to the destination buffer by the module crt0cons. This bug is fixed now.

http://vortex.masmcode.com/files/Wcrt0_7.zip

ParseCmd5.zip : Command-line parser for Jwasm \ Masm \ Poasm console applications