msvcrt

vcredist_x86.dll and version 8.0.50727.4053

南笙酒味 提交于 2019-11-30 08:12:49
问题 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 found. I have used vcredist_x86.exe in the past as a part of our installer to install runtime DLLs. It used to work. My problem is that even the latest version of vcredist_x86.exe ( Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)) doesn't install this version of the DLL. So which vcredist

Is MSVCRT under Windows like glibc (libc) under *nix?

倾然丶 夕夏残阳落幕 提交于 2019-11-30 00:11:55
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 understanding is that MSVCRT is the C runtime library, somewhat analogous to glibc/libc.so under *nix. Why do Windows programs have to bring along their C libraries with them, instead of just sharing the system-wide libc? Update: thanks to Shog9, I started to read about SxS, which has further opened up my eyes to the DLL linkage issues (DLL Hell) - http://blogs.msdn.com/b/martynl/archive/2005/10/13

Why does my application require Visual C++ Redistributable package

强颜欢笑 提交于 2019-11-29 20:16:21
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 Visual C++ Redistributable Package . I'm wondering why does my application require C++ Redistributable ? Standard C++ runtime library is shipped with Windows, isn't it? The only version of the C runtime library which is shipped by Microsoft with most of 32 bit Windows versions is msvcrt.dll . This library provides a typical set of library functions required by C and C++ programs. These include string

Is MSVCRT's implementation of fprintf() thread safe?

倖福魔咒の 提交于 2019-11-29 20:11:18
问题 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 same process) call fprintf() , the texts will not be mixed. That is, for example, if thread A calls fprintf(stdout, "aaaa"); and thread B calls fprintf(stdout, "bbbb"); it's guaranteed not to mix to become aabbaabb . Is there such a guarantee? 回答1: Yes. In the multithreaded runtime libraries, every

Why does _get_heap_handle equal to GetProcessHeap?

血红的双手。 提交于 2019-11-29 12:35:52
According to this article , CRT uses separate heap (is it private heap ?), but this little example shows that CRT heap and Default heap are the same: HANDLE heaps[64]; DWORD heapCount = GetProcessHeaps(64, heaps); for (int i = 0; i<heapCount; i++) printf("heap %d : [0x%x]\n", i, heaps[i]); printf("crt heap[0x%x], default heap[0x%x]\n", _get_heap_handle(), GetProcessHeap()); In what cases GetProcessHeap and _get_heap_handle return different handles? // Compiled with VS2012 (Platform toolset v110) This is new for VS2012, the CRT now uses the default process heap to allocate from. Previous

Does msvcrt uses a different heap for allocations since (vs2012/2010/2013)

大憨熊 提交于 2019-11-29 10:22:00
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 it no longer uses the private heap for allocations and uses process heap instead. Afaik it targeted issues of memory allocated in multiple libs which link statically against a crt and the subsequent release of memory in another lib where it was allocated. This is a major change in my view and I wonder why I cannot find any doc mentioning it. Either that or I made it up (which I doubt as I've

How to execute some code before entering the main() routine in VC?

五迷三道 提交于 2019-11-29 10:13:22
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 before entering the main() routine in VC (not VC++ code)? #include <stdio.h> #pragma section(".CRT$XIC",long,read) int __cdecl __initstdio1(void); #define _CRTALLOC(x) __declspec(allocate(x)) _CRTALLOC(".CRT$XIC") static pinit = __initstdio1; int z = 1; int __cdecl __initstdio1(void) { z = 10; return 0; } int main(void) { printf("Some code before main!\n"); printf("z = %d\n", z); printf("End!\n");

WaitForSingleObject on a file handle?

白昼怎懂夜的黑 提交于 2019-11-29 05:47:52
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 on a HANDLE that I've created with _get_osfhandle(fd) , where fd comes from a regular call to _open() . Is this possible? I have tried it in practice, and on some machines it works as expected (the HANDLE is always in the signaled state because you can read more data from it), and on some machines WaitForSingleObject() will block indefinitely if you let it. The MSDN page for WaitForSingleObject()

Using msvcrt.getch() in Eclipse / PyDev

本小妞迷上赌 提交于 2019-11-28 12:18:26
I wanted to use msvcrt.getch() in Eclipse with PyDev to read a signe char but I found out that it just don't work (but It works in the Windows console). Any idea what to do ? lolipop Maybe use sys.stdin.read when run in PyDev? like sys.stdin.read(1) read 1 line from input...For use in Windows console and in PyDev make same selection based on os and run variants(using sys.stdin.isatty ). For example next code read timelimited user input. But when run in Windows console if program's standard input is piped in with another program's standard output, then sys.stdin.isatty returns False and input

timegm cross platform

笑着哭i 提交于 2019-11-28 11:59:22
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 implementation? For example what is the difference between tzset() and _tzset() or setenv() ans _setenv() ? It seems the do the same thing in the same way... I'm using msvc ( 2010 ), have I to prefer the Windows CRT Implementation? EDIT 1 Well I want convert in a portable way a struct tm expressed in UTC in a time_t , but there's no portable way to do that. I've to write the function for different