std::stoi doesn’t exist in g++ 4.6.1 on MinGW

This is a result of a non-standard declaration of vswprintf on Windows. The GNU Standard Library defines _GLIBCXX_HAVE_BROKEN_VSWPRINTF on this platform, which in turn disables the conversion functions you’re attempting to use. You can read more about this issue and macro here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37522. If you’re willing to modify the header files distributed with MinGW, you … Read more

Using Component Object Model (COM) on non-Microsoft platforms

Answering myself but I managed to find the perfect library for OLE/COM calling in non-Microsoft compilers : disphelper. (it’s available from sourceforge.net under a permissive BSD license). It works both in C and C++ (and thus any other language with C bindings as well). It uses a printf/scanf-like format string syntax. (You pass whatever you … Read more

printf, wprintf, %s, %S, %ls, char* and wchar*: Errors not announced by a compiler warning?

I suspect GCC (mingw) has custom code to disable the checks for the wide printf functions on Windows. This is because Microsoft’s own implementation (MSVCRT) is badly wrong and has %s and %ls backwards for the wide printf functions; since GCC can’t be sure whether you will be linking with MS’s broken implementation or some … Read more

How do I compile and link a 32-bit Windows executable using mingw-w64

That depends on which variant of toolchain you’re currently using. Both DWARF and SEH variants (which come starting from GCC 4.8.0) are only single-target. You can see it yourself by inspecting the directory structure of their distributions, i.e. they contain only the libraries with either 64- or 32-bit addressing, but not both. On the other … Read more

Adding leading underscores to assembly symbols with GCC on Win32?

One option, though dangerous, is to convince GCC to omit the ABI-required leading underscore. -fleading-underscore This option and its counterpart, -fno-leading-underscore, forcibly change the way C symbols are represented in the object file. One use is to help link with legacy assembly code. Warning: the -fleading-underscore switch causes GCC to generate code that is not … Read more

tech