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
6
votes
2 answers

Assertion error in CRT calling _osfile() in VS 2008?

I have a C++ code base that has been working for a long time. The code base was a legacy VS 2003 set of projects that I recently migrated to VS 2008. The migration seemed to be successful in that the resulting program built, and run. I reinstalled…
Dan Nissenbaum
  • 13,558
  • 21
  • 105
  • 181
6
votes
1 answer

CRT library type

I'm trying to get a better grasp on the CRT library options in Visual Studio 2013 (C++ -> Code Generation -> Runtime Libary) and how to know which option to select (and when to change the default). From MSDN: A reusable library and all of its users…
user974967
  • 2,928
  • 10
  • 28
  • 45
6
votes
3 answers

CRT virtual destructor

I ran into a heap corruption today caused by different CRT settings (MTd MDd) in my dll and my actual project. What I found strange is that the application only crashed when I set the destructor in the dll to be virtual. Is there an easy explanation…
Poisonbox
  • 65
  • 5
6
votes
1 answer

Make a simple CRT0 in C or assembly

I'm back with C/C++ and ASM and I want to play a little bit with fire. I found out that when you compile and link code into an executable for Windows it is dynamically linked to some libraries that must exists on any computer where that application…
ali
  • 10,927
  • 20
  • 89
  • 138
5
votes
1 answer

Implementing Chinese Remainder Theorem in JavaScript

I have been trying to solve Advent of Code 2020 day 13 part 2 task. I found a lot of hints talking about something called Chinese Remainder Theorem. I have tried some implementations following npm's nodejs-chinesse-remainders but this implementation…
SirPeople
  • 4,248
  • 26
  • 46
5
votes
1 answer

Which is the forward looking name, vc_redist..exe or vcredist_.exe?

It appears that Microsoft Visual C++ offers equivalent copies of the VC++ runtime redistributable under two formats of names. VS2017: @ /cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Redist/MSVC/14.16.27012 $ cksum.exe…
acm
  • 12,183
  • 5
  • 39
  • 68
5
votes
1 answer

When building a DLL; what type of CRT should I link to?

In windows; there are 2 options to link to a CRT: Multithreaded, static link Multithreaded, dynamic link Can someone shed some light on what is the best practice here? Should I link 'statically' to the CRT or do a dynamic link? If i do a dynamic…
shergill
  • 3,738
  • 10
  • 41
  • 50
5
votes
1 answer

error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(delete_scalar.obj)

I have written a c++ static library that overwrites the delete operator. When using the library in a test project, the project produces the following error: error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in…
Jester
  • 51
  • 1
  • 5
5
votes
1 answer

How feasible is it to virtualise the FILE* interfaces of C?

It have often noticed that I would have been able to solve practical problems in C elegantly if there had been a way of creating a ‘virtual FILE’ and attaching the necessary callbacks for events such as buffer full, input requested, close, flush. It…
PJTraill
  • 1,353
  • 12
  • 30
5
votes
1 answer

How can I use crt0.o to setup .bss and .data in my bare metal C program?

I successfully wrote a bare metal C program which is running on my STM32F4. It's nothing fancy, just the usual led-blinky-program. In this project I have written the initialization routines which is clearing the .bss section and initializing the…
Multisync
  • 767
  • 6
  • 25
5
votes
1 answer

Windows application that optionally writes to a console in C++?

I'd like to have a windows application with the following behaviour: 1. if it is started from an existing command line window (cmd.exe) then it writes its stdout to that console. 2. If it is started by double clicking its icon, it doesn't open a new…
shoosh
  • 76,898
  • 55
  • 205
  • 325
5
votes
1 answer

CRT initialization and DLLMain

Quotes: From the document "Best Practices for Creating DLLs" http://download.microsoft.com/download/a/f/7/af7777e5-7dcd-4800-8a0a-b18336565f5b/DLL_bestprac.doc of Microsoft: "DLLs often have complex interdependencies that implicitly define the order…
amanjiang
  • 1,213
  • 14
  • 33
5
votes
1 answer

Compiling Microsoft CRT 11 (msvcrt110.dll) - What is the correct order of includes?

I am trying to compile the Microsoft CRT 11 by myself (The version that comes along with VS2012). I'm aware that until VS2008 this action was completely supported by Microsoft: http://msdn.microsoft.com/en-us/library/k9a8ehy3(v=vs.90).aspx But since…
user972014
  • 3,296
  • 6
  • 49
  • 89
5
votes
1 answer

OpenSSL, Converting CRT to PEM

I've been trying to use openssl to convert a .crt certificate to a .pem openssl.exe x509 -in server.crt -out openssl.der -outform DER After using that command, I get unable to load certificate 1760:error:0906D06C:PEM routines:PEM_read_bio:no…
user3772004
  • 51
  • 1
  • 1
  • 2
5
votes
4 answers

Why are there multiple C functions for case-insensitive comparison

For comparing any strings without considering their case, there are various C library functions such as strcasecmp(), stricmp() and stricmpi(). What is the difference between these?
userrp1519825
  • 4,453
  • 2
  • 14
  • 13