C language > Tips & tricks

crtmin

(1/2) > >>

TimoVJL:
When someone want to make program without normal crt.lib.
Examples to make a minimal crtmin.lib nocrt.lib.

--- Code: ---@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
--- End code ---

--- Code: ---@REM crtmin64.cmd
polib crt64.lib -extract:_chkstk.obj
polib _chkstk.obj -out:nocrt64.lib
pause
--- End code ---
EDIT 2019-04-24: renamed example libs

bitcoin:
What differences between normal and minimal crt?

TimoVJL:
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

--- Code: ---@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

--- End code ---
x64
--- Code: ---@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

--- End code ---
EDIT 2019-04-24: renamed example libs

Vortex:
Hi bitcoin,

Another purpose of making a minimalist C run-time library is not to depend on external sources like msvcrt.dll

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)

Navigation

[0] Message Index

[#] Next page

Go to full version