NO

Author Topic: crtmin  (Read 6535 times)

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
crtmin
« on: December 17, 2017, 12:06:11 AM »
When someone want to make program without normal crt.lib.
Examples to make a minimal crtmin.lib nocrt.lib.
Code: [Select]
@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
Code: [Select]
@REM crtmin64.cmd
polib crt64.lib -extract:_chkstk.obj
polib _chkstk.obj -out:nocrt64.lib
pause
EDIT 2019-04-24: renamed example libs
« Last Edit: April 24, 2019, 10:39:17 AM by TimoVJL »
May the source be with you

Offline bitcoin

  • Member
  • *
  • Posts: 179
Re: crtmin
« Reply #1 on: April 18, 2019, 04:27:53 PM »
What differences between normal and minimal crt?

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: crtmin
« Reply #2 on: April 19, 2019, 01:30:20 AM »
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: [Select]
@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
Code: [Select]
@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
« Last Edit: April 24, 2019, 10:37:01 AM by TimoVJL »
May the source be with you

Offline Vortex

  • Member
  • *
  • Posts: 865
    • http://www.vortex.masmcode.com
Re: crtmin
« Reply #3 on: April 23, 2019, 11:56:34 AM »
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...

Offline jj2007

  • Member
  • *
  • Posts: 536
Re: crtmin
« Reply #4 on: April 24, 2019, 08:34:56 AM »
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)

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: crtmin
« Reply #5 on: April 24, 2019, 09:00:17 AM »
OK. A confusing name.
Maybe the NoCRT.lib is a better name for compiler specific support routines.
May the source be with you