Questions tagged [msvcrt]
MSVCRT is the Microsoft Visual C++ Runtime.
msvcrt
488
questions
290
votes
6
answers
234k
views
Resolving LNK4098: defaultlib 'MSVCRT' conflicts with
This warning:
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts
with use of other libs; use /NODEFAULTLIB:library
is a fairly common warning in Visual Studio. I'd like to understand the exact ...
152
votes
7
answers
111k
views
Should I compile with /MD or /MT?
In Visual Studio, there's the compile flags /MD and /MT which let you choose which kind of C runtime library you want.
I understand the difference in implementation, but I'm still not sure which one ...
62
votes
1
answer
87k
views
What is the cause of "This application has requested the Runtime to terminate it in an unusual way"?
There's a common error that gets thrown by the Visual C Runtime:
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for ...
48
votes
2
answers
48k
views
Why does my application require Visual C++ Redistributable package
I'm writing a simple C++ application in Visual Studio. It also has a setup project.
It works well on my development machine, but when I'm installing this application on user's machine it requires ...
46
votes
6
answers
58k
views
How to make vcredist_x86 reinstall only if not yet installed?
In my inno setup RUN selection I force silent install of MSVCRT. I wonder how to make it install itself only if not yet installed?
This is what I call now:
Filename: {tmp}\vcredist_x86.exe; ...
38
votes
6
answers
139k
views
Visual C++ executable and missing MSVCR100d.dll
I know this has been asked in other places and answered, but I'm having issues with MS Visual Studio 2010. I've developed a C++ executable but if I run the Release version on a machine that doesn't ...
38
votes
3
answers
29k
views
How do I get the file HANDLE from the fopen FILE structure?
The fopen function returns a pointer to a FILE structure, which should be considered an opaque value, without dealing with its content or meaning.
On Windows, the C runtime is a wrapper of the ...
36
votes
6
answers
60k
views
Visual studio 2015 run-time dependencies or how to get rid of Universal CRT?
Compiled couple of .dll's using visual studio 2015, and tried to deploy on some older windows 7 / 64 bit. Tried also to guess which dll's are needed for application to start and copied MSVCP140.DLL &...
34
votes
4
answers
28k
views
Should I redistribute msvcrt.dll with my application?
Should I redistribute msvcrt.dll with my application and use the private dll if some of the application's libs dynamically depend on msvcrt.dll? I.e. are any incompatibility issues possible with the ...
31
votes
4
answers
13k
views
Is MSVCRT under Windows like glibc (libc) under *nix?
I frequently come across Windows programs that bundle in MSVCRT (or their more current equivalents) with the program executables. On a typical PC, I would find many copies of the same .DLL's. My ...
31
votes
1
answer
33k
views
Differences between msvcrt, ucrt and vcruntime libraries
Can someone please explain the difference between these? Internet lookup has confused me.
I am using VS2019.
24
votes
2
answers
18k
views
How can fopen_s be more safe than fopen?
I'm working on legacy code for Windows platform. When I compile the code in VS2013, it give following warning:
error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s ...
24
votes
4
answers
13k
views
Windows malloc replacement (e.g., tcmalloc) and dynamic crt linking
A C++ program that uses several DLLs and QT should be equipped with a malloc replacement (like tcmalloc) for performance problems that can be verified to be caused by Windows malloc. With linux, there ...
23
votes
2
answers
23k
views
What is security cookie in C++?
I have read from Google that it is used for controlling buffer overruns at application level and it is called by CRT.
It also says that
" Essentially, on entry to an overrun-protected function, the ...
23
votes
4
answers
15k
views
Should I link to the Visual Studio C runtime statically or dynamically?
I have read arguments on both sides about whether one should link to the C runtime library statically or dynamically in Visual Studio projects, and I'm still not entirely sure what to think.
My ...
20
votes
5
answers
23k
views
timegm cross platform
I'm using Visual Studio c++ Compiler ( 2010 ), but the library has different implementation of ANSI C and POSIX libraries function.
What is the difference between ANSI C function and Windows CRT ...
20
votes
3
answers
12k
views
PyCharm: msvcrt.kbhit() and msvcrt.getch() not working?
I've tried to read one char from the console in PyCharm (without pressing enter), but to no avail.
The functions msvcrt.getch() stops the code, but does not react to key presses (even enter), and ...
17
votes
2
answers
9k
views
WaitForSingleObject on a file handle?
What happens when you call WaitForSingleObject() on a handle you've created with CreateFile() or _get_osfhandle()?
For reasons not worth explaining I would like to use WaitForSingleObject() to wait ...
15
votes
2
answers
7k
views
Why might _CrtSetBreakAlloc not cause a breakpoint?
I'm using Visual CRT's memory leak detection routines from <crtdbg.h>; when I call _CrtDumpMemoryLeaks one allocation is reported consistently on every invocation of the program:
{133} normal ...
14
votes
5
answers
17k
views
Why is vector deleting destructor being called as a result of a scalar delete?
I have some code that is crashing in a large system.
However, the code essentially boils down to the following pseudo-code.
I've removed much of the detail, as I have tried to boil this down to the ...
14
votes
2
answers
4k
views
Are Visual C++ dynamic runtime libraries part of the Windows OS nowadays?
Are the dynamic runtime libraries for Visual C++ (more specifically 2008) part of the Windows OS nowadays? I noticed that at least on Windows 8 you no longer need to ship these with your application ...
14
votes
1
answer
5k
views
Runtime Library mis-matches and VC++ - Oh, the misery!
It seems that all my adult life I've been tormented by the VC++ linker complaining or balking because various libraries do not agree on which version of the Runtime library to use. I'm never in the ...
13
votes
0
answers
374
views
thread_local + std::thread deadlock on destruction
Anyone knows what kind of UB is this? The following code deadlocks on jthread destruction when built with MSVC 19.29.30148, sometimes it deadlocks after std::cout and sometimes before.
This is somehow ...
11
votes
6
answers
12k
views
.crt section? What does this warning mean?
I've got this warning recently (VC++ 2010)
warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
I'm assuming this is the Critical Section. It's been a ...
11
votes
1
answer
9k
views
check what run-time static library or dll uses
is there a tool in windows SDK to ckeck what CRT a library uses?
for example I have a *.lib file, how do check if it's compiled with /MDd flag or /MT?
also how to check the same for dll or exe?
can ...
11
votes
4
answers
11k
views
How to Enforce C++ compiler to use specific CRT version?
I am using VS2008 for developing a COM dll which by default uses CRT version 9
but I am using TSF (Text service framework) that is not compatible with the new CRT. I think the solution is to use the ...
11
votes
9
answers
31k
views
vcredist_x86.dll and version 8.0.50727.4053
Visual C++ 2005 I build on my system use CRT DLLs version 8.0.50727.4053. I believe it is the latest one and was automatically updated by Windows.
On user systems, this version of the DLL is not ...
11
votes
1
answer
6k
views
Using MinGW to build a Windows DLL that depends on Visual Studio CRT (msvcr110.dll) NOT on Windows CRT (msvcrt.dll)
I am trying to build a DLL using MinGW for Windows. I know that by default building using MinGW introduces a dependency on msvcrt.dll that ships with Windows. However, I want my DLL not to have a ...
10
votes
2
answers
6k
views
fread Only first 5 bytes of .PNG file
I've made a simple resource packer for packing the resources for my game into one file. Everything was going fine until I began writing the unpacker.
I noticed the .txt file - 26 bytes - that I had ...
10
votes
3
answers
2k
views
What is the purpose of Microsoft's underscore C functions?
This question is about the same subject as strdup or _strdup? but it is not the same. That question asks how to work around MS's renamings, this question asks why they did it in the first place.
For ...
10
votes
2
answers
20k
views
How to disable buffer overflow checking in the Visual C++ Runtime?
i, and a few thousand other people, are getting an error being thrown by the Microsoft Visual C++ Runtime:
Which for the benefit of search engines, says:
Microsoft Visual C++ Runtime Library
Buffer ...
9
votes
4
answers
6k
views
MS Visual C++ runtime library - what for?
What's in MS Visual C++ runtime library? I mean, I googled it, and I always found things like help, app xxxx gives me MS Visual C++ runtime library error, with no explanation.
I thought that Windows ...
9
votes
3
answers
3k
views
Statically linking against library built with different version of C Runtime Library, ok or bad?
Consider this scenario:
An application links to 3rd party library A.
A is built using MSVC 2008 and is statically linking (ie. built with /MT) to the C Runtime Library v9.0.
The application is built ...
9
votes
1
answer
3k
views
list available platform toolsets
Is there any method to list platform toolsets available in VS2012? I mean a list that might contain v90, v100, v110, v110_xp and any externally provided platform toolset. Alternatively (should that be ...
9
votes
1
answer
515
views
What memory management algorithms are used by the major compiler vendors?
This is a subset of a previous question.
As an exercise I am writing a memory manager - that is, the code which implements malloc, realloc and free (or new and delete.) The RTL for my language, ...
8
votes
6
answers
7k
views
How to execute some code before entering the main() routine in VC?
I am reading Microsoft's CRT source code, and I can come up with the following code, where the function __initstdio1 will be executed before main() routine.
The question is, how to execute some code ...
8
votes
1
answer
3k
views
Is MSVCRT's implementation of fprintf() thread safe?
It seems that glibc's implementation of fprintf() is thread-safe, but is that so for Microsoft's CRT, as well?
By thread-safe, I don't mean just crashing, but also that if multiple threads (in the ...
8
votes
2
answers
17k
views
Python input single character without enter
What I am trying to do is make a simple pi memorization game in Python. What I need is a way to get input from the user without having to press 'enter' after every character. It sounds like I need ...
8
votes
1
answer
3k
views
Different versions of msvcrt in ctypes
In Windows, the ctypes.cdll.msvcrt object automatically exists when I import the ctypes module, and it represents the msvcrt Microsoft C++ runtime library according to the docs.
However, I notice ...
8
votes
2
answers
7k
views
LoadLibrary() fails to load DLL with manifest and private assembly
I am working on a Windows application (EXE) that uses multiple DLLs. Development is in VCExpress 2005 (VC 8.0), using C only.
Some of these DLLs are plug-ins/add-ons/extensions that are dynamically ...
8
votes
2
answers
17k
views
MSVCR100.dll not found error even when it is installed
i get the following error when i try to run an exe on a x64 machine that was build for x86 CPU using the MC++ compiler (vs2010) on a x86 machine:
i already have visual studio 2012 (along with Visual ...
8
votes
3
answers
5k
views
mixing code compiled with /MT and /MD
I have a large body of code, compiled with /MT (i.e. expecting to statically link against the CRT). I need to combine this with a static third-party library, which has been built with /MD (i.e. ...
8
votes
3
answers
11k
views
How to have password echoed as asterisks [duplicate]
I'm trying make a login window where a user is prompted to enter their Username and Password, although when the password is entered I am looking for asterisks to be printed, like common password entry ...
8
votes
2
answers
4k
views
Is there a fundamental difference between malloc and HeapAlloc (aside from the portability)? [duplicate]
I'm having code that, for various reasons, I'm trying to port from the C runtime to one that uses the Windows Heap API. I've encountered a problem: If I redirect the malloc/calloc/realloc/free calls ...
8
votes
2
answers
493
views
What is the symbol `myLibrary!__scrt_stub_for_is_c_termination_complete+0x12345`
The symbol myLibrary!__scrt_stub_for_is_c_termination_complete+0x12345 appears in the stack trace of a crashed application. It is C++ compiled with MSVC2015 and heavily uses Qt.
myLibrary does not ...
7
votes
5
answers
3k
views
What's the scenario to use the atexit function?
CRT function atexit() could register a function to run after main function returns. I am wondering what's the typical scenario to use this? Is it (atexit) really necessary?
7
votes
1
answer
2k
views
Does msvcrt uses a different heap for allocations since (vs2012/2010/2013)
I've read about that some time ago but am unable to locate the change to the crt on msdn or anywhere else in the web.
I think the msvcrt has been changed in the VC++ release of VS2012 in a way that ...
7
votes
4
answers
1k
views
Mixing versions of the MSVCRT
So, I have a C++ library with a statically linked copy of the MSVCRT. I want for anyone to be able to use my library with any version of the MSVC Runtime. What is the best way to accomplish this goal? ...
7
votes
2
answers
3k
views
FreeConsole behaviour on Windows 8
On Windows 8, we have an issue with FreeConsole. It seems to close the stdio handles, without shutting the file streams.
This may be a Windows 8 problem, or it could be that I simply don't understand ...
7
votes
1
answer
2k
views
Reverse-engineering SEH: Why doesn't my IDENTICAL assembler code work like the original?
I'm trying to reverse-engineer the Visual C++ 2008 SEH handler named __CxxFrameHandler3 to provide an implementation which can delegate the result to (the older version of) __CxxFrameHandler in msvcrt....