msvcrt

vs2012 toolset compatibility

跟風遠走 提交于 2019-12-03 07:36:54
In my VS2012 I have 4 toolsets available: v90, v100, v110 and v110_xp. I did a simple test with two projects testlib (a static library) and testexe (console application). The interface was just one function with signature void test() . The results: testlib(v90), testexe(anything other than v90) -> does not link testlib(v100), testexe(v110 or v110_xp) -> does link However, it seemed somewhat weird to me that v100 and v110 would link so I tried to complicate the scenario a little bit. Now my method looks like this: std::map<std::string, std::string> test(const std::string& arg) . As expected,

Runtime Library mis-matches and VC++ - Oh, the misery!

烂漫一生 提交于 2019-12-03 02:23:13
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 mood to master that dismal subject. So I just try to mess with it until it works. The error messages are never useful. Neither is the Microsoft documentation on the subject - not to me at least. Sometimes it does not find functions - because the name-mangling is not what was expected? Sometimes it refuses to mix-and-match. Other times it just says, "LINK : warning LNK4098: defaultlib 'LIBCMTD'

PInvokeStackImbalance while using “static extern int system(string str)”

情到浓时终转凉″ 提交于 2019-12-02 09:10:31
问题 I'm trying to use the system(string str) Command for dos-operations in C#. namespace XYZ { internal class Program { [DllImport("msvcrt.dll")] static extern int system(string str); static void Main(string[] args) { string Command = Console.ReadLine(); system(Command); /* Excutes command, then "PInvokeStackImbalance". */ } } } I know using static extern int system(string str) is a bad solution, but I've tried other solutions which did not work. 回答1: You forgot to specify the calling convention:

How to get location of needed runtime libraries for msvc

别说谁变了你拦得住时间么 提交于 2019-12-02 08:58:24
I have custom wrapper over CMake, which perform configuring, compilation, and creating distrib for various platforms (win32, SunOS and so on) and different compilers. I need to put into distrib all needed runtime libraries (libgcc_s.so, libstdc++.so for *nix like OS. msvcr90.dll, msvcp100.dll for win32). For example, gcc has mechanism, which allows to get full names of these libraries: # get location of libgcc_s of default compiler bash-3.2$ g++ -print-file-name=libgcc_s.so /usr/local/lib/gcc/sparc-sun-solaris2.10/3.4.6/../../../libgcc_s.so # get location of libstdc++ of custom compiler bash-3

What's the name of the “create hard link” function in MSVCRT?

折月煮酒 提交于 2019-12-02 07:10:05
To fix a bug in this answer : What's the correct name of the function to create a hard link in MSVCRT? cHao Oddly enough, there's a function called CreateHardLink . But it doesn't live in MSVCRT; it's part of Kernel32. 来源: https://stackoverflow.com/questions/6015006/whats-the-name-of-the-create-hard-link-function-in-msvcrt

FreeConsole behaviour on Windows 8

走远了吗. 提交于 2019-12-01 17:23:25
问题 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 the (totally absurd) way the Windows console/GUI app subsystem does things. What's going on? Minimal example below. Tested with compilers: VS2005, VS2013, VS2017, using statically linked CRT. #include <windows.h> #include <io.h> #include <stdio.h> static void testHandle(FILE* file) { HANDLE h =

FreeConsole behaviour on Windows 8

旧街凉风 提交于 2019-12-01 17:20:55
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 the (totally absurd) way the Windows console/GUI app subsystem does things. What's going on? Minimal example below. Tested with compilers: VS2005, VS2013, VS2017, using statically linked CRT. #include <windows.h> #include <io.h> #include <stdio.h> static void testHandle(FILE* file) { HANDLE h = (HANDLE)_get_osfhandle(fileno(file)); DWORD flags; if (!GetHandleInformation(h, &flags)) { MessageBoxA(0

PyCharm: msvcrt.kbhit() and msvcrt.getch() not working?

非 Y 不嫁゛ 提交于 2019-12-01 15:56:31
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 msvcrt.kbhit() always returns 0. For example this code prints nothing: import msvcrt while 1: if msvcrt.kbhit(): print 'reading' print 'done' I am using Windows 7, PyCharm 3.4 (the same heppens in idle). What is wrong? Is there any other way to just read input without enter? It's possible in a special mode of the Run window. Check the Emulate terminal in output console setting checkbox in Run/Debug

Memory Allocation in Static vs Dynamic Linking of C Runtime

孤人 提交于 2019-12-01 11:08:12
My program's architecture involves plugins (dlls) and the exe (obviously). We are the only plugin provider. I was told that allocating memory in a plugin and then freeing it in the exe code was a potential problem if we statically linked the c runtime. However, if we dynamically linked it, there was just one heap and the c runtime had access to all of it. We switched to dynamic linking on the basis of this advice, but all we've seen from the switch is headaches and trouble related to distribution and installation of the new runtimes. (Don't know what we avoided in terms of memory allocation

Memory Allocation in Static vs Dynamic Linking of C Runtime

﹥>﹥吖頭↗ 提交于 2019-12-01 08:11:01
问题 My program's architecture involves plugins (dlls) and the exe (obviously). We are the only plugin provider. I was told that allocating memory in a plugin and then freeing it in the exe code was a potential problem if we statically linked the c runtime. However, if we dynamically linked it, there was just one heap and the c runtime had access to all of it. We switched to dynamic linking on the basis of this advice, but all we've seen from the switch is headaches and trouble related to