Questions tagged [crt]

For issues relating to utilizing the C runtime library.

The C runtime library is a special program library used by a compiler, to implement functions built into the C programming language, during the execution (runtime) of a computer program.

Not to be confused with CRT terminals.

364 questions
4
votes
2 answers

Visual Studio Linking errors. Order in which MFC, CRT included?

This question has been brought up numerous times, but Visual Studio never ceases to challenge me. We have an application that should be self-sufficient, i.e. not depend on any 3rd party libraries. This is why we build everything statically using the…
ak.
  • 3,329
  • 3
  • 38
  • 50
4
votes
2 answers

Why does Visual Studio CRT memory report show CRT blocks

I am practicing using CRT library to find memory leaks. I wrote some code like this: #define _CRTDBG_MAP_ALLOC #include #include #include typedef struct NodeLL { int value; struct NodeLL *next; } Node; void…
Amber
  • 73
  • 6
4
votes
1 answer

Why is RtlFillMemory/RtlCopyMemory defined as macro

From definition (winnt.h): #define RtlCopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length)) #define RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length)) we see this functions are actually macros,…
Xearinox
  • 3,224
  • 2
  • 24
  • 38
4
votes
2 answers

What's with this "CRT not initialized" error?

I created an empty C++ project in Visual Studio 2012 Express (for Desktop of course), and added some random basic code: #include #include typedef struct examplestruct { unsigned char num1; unsigned short num2; …
Archimaredes
  • 1,397
  • 12
  • 26
4
votes
2 answers

Using a C library from a non-C program: is it necessary to explicitely initialize the "under-the-hood" C library?

I know that when you compile and link a C program, you link it with C library C runtime startup code I wonder if I write a program (in a new language, or just C without linking to this code) and link it directly to a C code shared library (say…
rubenvb
  • 74,642
  • 33
  • 187
  • 332
3
votes
1 answer

_invalid_parameter gets no useful information in Release build

I am using _set_invalid_parameter_handler to override the default behaviour of the program when a CRT function gets an invalid parameter, which is to crash with 0xc0000417 (STATUS_INVALID_CRUNTIME_PARAMETER). This is my handler: void…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
3
votes
0 answers

malloc returns NULL and sets errno to ENOMEM, but there is plenty of heap space available?

I have a situation in which malloc() returns NULL and sets errno to ENOMEM. But the CRT heap (which is growable) has plenty of memory to work with. At the time of malloc, my process memory is about 900 MB. The host process is a Java executable…
Martin Frank
  • 199
  • 1
  • 13
3
votes
2 answers

Detecting whether the CRT initialization was done in an injected process

I'm working on an application that injects a dll when a process starts (Suspend --> Inject --> Resume) The very first call in DllMain with DLL_PROCESS_ATTACH (in the dll I injected) is a call to MessageBox() (just for debugging purpose). However,…
Elad
  • 123
  • 1
  • 7
3
votes
3 answers

CRT not initialized

I'm trying to compile one project with MSVC 2010, compilation is ok, but when I try to run the app, it gives me CRT not initialized error. It is a console application, so I tried to specify mainCRTStartup as Entry Point, but it didn't help. In the…
3
votes
1 answer

Retro CRT curved screen effect for website/ccs

OK, so this is NOT a self-promotion!! I currently have an cyberpunk website that is running phpbb forum, which is using the default prosilver theme, on top of that theme I have another theme/skin called 1978 it gives the website that old school…
Cyberstrator
  • 71
  • 1
  • 4
3
votes
0 answers

How to link statically with the CRT

I have the following 'hello world' NASM assembly code bits 64 default rel segment .data msg db "Hello world!", 0 segment .text global main extern puts main: sub rsp, 40 lea rcx, [msg] call puts xor rax, rax …
john
  • 85,011
  • 4
  • 57
  • 81
3
votes
1 answer

Linking an object file that contains stdio functions with ld, no crt0.o found

Recently I've been learning linker and trying to link simple files using ld, but then, I failed to do so (probably because of architecture x64?... I cannot really tell). Here are the files I used: #include int fun(int x); int main(){ …
Matt_Caner
  • 31
  • 2
3
votes
1 answer

Why does the C runtime not call my exit()?

The C standard states that... ...a return from the initial call to the main function is equivalent to calling the exit function with the value returned by the main function as its argument. From what I see, this is usually implemented by the C…
DevSolar
  • 67,862
  • 21
  • 134
  • 209
3
votes
2 answers

/usr/bin/ld.gold: error: /usr/lib/gcc/x86_64-linux-gnu/6/crtbeginT.o: requires dynamic R_X86_64_32

I'm running into the following error when trying to compile a static Haskell executable: /usr/bin/ld.gold: error: /usr/lib/gcc/x86_64-linux-gnu/6/crtbeginT.o: requires dynamic R_X86_64_32 reloc against '__TMC_END__' which may overflow at runtime;…
Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
3
votes
1 answer

Static CRT link

im trying to build my project and I want to link the windows CRT statically, but I find some errors trying to linking it, I've included in the linking list these ones: libcmt.lib LIBCPMT.LIB libucrt.lib libvcruntime.lib but I get these linking…
Malium
  • 79
  • 1
  • 6