0 out of 5 rated this helpful - Rate this topic

C Run-Time Error R6030

CRT not initialized

This error occurs if you are using the CRT, but the CRT startup code was not executed. It is possible to get this error if the linker switch /ENTRY is used to override the default starting address, usually mainCRTStartup, wmainCRTStartup for a console EXE, WinMainCRTStartup or wWinMainCRTStartup for a Windows EXE, or _DllMainCRTStartup for a DLL. Unless one of the above functions is called on startup, the C Runtime will not be initialized.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Process needed to troubleshoot issue.
If the /ENTRY switch is not used then what steps can I use to identify the cause of the issue?

The Stack looks as follows before the issue occurs.
0012e200 7858375e MSVCR90!malloc+0x13 [f:\dd\vctools\crt_bld\self_x86\crt\src\malloc.c @ 159]
0012e214 611044e0 MSVCR90!_malloc_crt+0x11

Running the code 1 step at a time producess the following path through the code:
0:000> p
eax=00000000 ebx=7c829ff6 ecx=611044d2 edx=00130000 esi=00000080 edi=00130000
eip=78583d58 esp=0012e1f8 ebp=0012e200 iopl=0         nv up ei pl nz na pe cy
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000207
MSVCR90!malloc+0x19:
78583d58 57              push    edi
0:000>
eax=00000000 ebx=7c829ff6 ecx=611044d2 edx=00130000 esi=00000080 edi=00130000
eip=78583d59 esp=0012e1f4 ebp=0012e200 iopl=0         nv up ei pl nz na pe cy
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000207
MSVCR90!malloc+0x1a:
78583d59 833d60c15b7800  cmp     dword ptr [MSVCR90!_crtheap (785bc160)],0 ds:0023:785bc160=00000000
0:000>
eax=00000000 ebx=7c829ff6 ecx=611044d2 edx=00130000 esi=00000080 edi=00130000
eip=78583d60 esp=0012e1f4 ebp=0012e200 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246
MSVCR90!malloc+0x21:
78583d60 7518            jne     MSVCR90!malloc+0x3b (78583d7a)          [br=0]
0:000>
eax=00000000 ebx=7c829ff6 ecx=611044d2 edx=00130000 esi=00000080 edi=00130000
eip=78583d62 esp=0012e1f4 ebp=0012e200 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246
MSVCR90!malloc+0x23:
78583d62 e87ae9fbff      call    MSVCR90!_FF_MSGBANNER (785426e1)

On a working application you get the following path:
0:000> p
eax=00000000 ebx=7c829ff6 ecx=611044d2 edx=00080000 esi=00000080 edi=00080000
eip=78583d58 esp=0007f268 ebp=0007f270 iopl=0         nv up ei pl nz na pe cy
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000207
MSVCR90!malloc+0x19:
78583d58 57              push    edi
0:000>
eax=00000000 ebx=7c829ff6 ecx=611044d2 edx=00080000 esi=00000080 edi=00080000
eip=78583d59 esp=0007f264 ebp=0007f270 iopl=0         nv up ei pl nz na pe cy
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000207
MSVCR90!malloc+0x1a:
78583d59 833d60c15b7800  cmp     dword ptr [MSVCR90!_crtheap (785bc160)],0 ds:0023:785bc160=008e0000
0:000>
eax=00000000 ebx=7c829ff6 ecx=611044d2 edx=00080000 esi=00000080 edi=00080000
eip=78583d60 esp=0007f264 ebp=0007f270 iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000206
MSVCR90!malloc+0x21:
78583d60 7518            jne     MSVCR90!malloc+0x3b (78583d7a)          [br=1]
0:000>
eax=00000000 ebx=7c829ff6 ecx=611044d2 edx=00080000 esi=00000080 edi=00080000
eip=78583d7a esp=0007f264 ebp=0007f270 iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000206
MSVCR90!malloc+0x3b:
78583d7a a180d65b78      mov     eax,dword ptr [MSVCR90!__active_heap (785bd680)] ds:0023:785bd680=00000001

Advertisement