News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

crtmin

Started by TimoVJL, December 17, 2017, 12:06:11 AM

Previous topic - Next topic

TimoVJL

When someone want to make program without normal crt.lib.
Examples to make a minimal crtmin.lib nocrt.lib.
@REM crtmin.cmd
polib crt.lib -extract:_chkstk.obj -extract:_ftoll.obj -extract:_llshl.obj -extract:_llshr.obj -extract:_llmul.obj -extract:_lldiv.obj
polib.exe _chkstk.obj _llshl.obj _llshr.obj _ftoll.obj _lldiv.obj _llmul.obj -out:nocrt.lib
pause
@REM crtmin64.cmd
polib crt64.lib -extract:_chkstk.obj
polib _chkstk.obj -out:nocrt64.lib
pause
EDIT 2019-04-24: renamed example libs
May the source be with you

bitcoin

What differences between normal and minimal crt?

TimoVJL

#2
crtmin.lib usually have a compiler specific routines, that do not belong to C standard.
nocrt.lib for my examples using Pelles C 9
x86
@SET crtlib=crt.lib
polib %crtlib% -extract:_chkstk.obj -extract:_llshl.obj -extract:_llshr.obj -extract:_lldiv.obj -extract:_llmul.obj -extract:_ullmod.obj  -extract:_ulldiv.obj  -extract:_crtabort.obj  -extract:_ftoll.obj  -extract:_fvalues.obj  -extract:_values.obj  -extract:seh1.obj  -extract:seh2.obj
polib -out:nocrt.lib *.obj
x64@SET crtlib=crt64.lib
polib %crtlib% -extract:_chkstk.obj  -extract:_ehandler.obj polib -extract:_crtabort.obj  -extract:_fvalues.obj  -extract:_values.obj
polib -out:nocrt64.lib *.obj
EDIT 2019-04-24: renamed example libs
May the source be with you

Vortex

Hi bitcoin,

Another purpose of making a minimalist C run-time library is not to depend on external sources like msvcrt.dll
Code it... That's all...

jj2007

I am not a fan of the CRT, and don't use it in my libraries. However, if you are programming in Windows, then Msvcrt.dll is present on your machine. It's not an "external" thing that the user has to buy and install, it's simply there waiting to be used.

IMHO rolling your own is justified only if it improves your stuff: Can you reduce code size with an own routine? No, because a call to an existing function costs 6 bytes. Which leaves exactly one reason to reinvent the wheel: speed 8)

TimoVJL

OK. A confusing name.
Maybe the NoCRT.lib is a better name for compiler specific support routines.
May the source be with you