Question: Thinking of using MinGW as an alternative to VC++ on Windows, but am worried about compatibility issues. I am thinking in terms of behaviour, performance on Windows (any chance a MinGW compiled EXE might act up). Also, in terms of calling the Windows API, third-party DLLs, generatic and using compatible static libraries, and other issues encountered with mixing parts of the same application with the two compilers.

Answer: 
First, MinGW is not a compiler, but an environment, it is bundled with gcc.

If you think of using `gcc` to compile code and have it call the Windows API, it's okay as it's C; but for C++ DLLs generated by MSVC, you might have a harsh wake-up call.

The main issue is that in C++, each compiler has its own name mangling (or more generally ABI) and its own Standard library. You cannot mix two different ABI or two different Standard Libraries. End of the story.

Clang has a specific MSVC compatibility mode, allowing it to accept code that MSVC accepts *and* to emit code that is binary compatible with code compiled with MSVC. Indeed, it is even [officially supported in Visual Studio](https://devblogs.microsoft.com/cppblog/clang-llvm-support-in-visual-studio/).

Obviously, you could also simply do the cross-DLL communication in C to circumvent most issues.

*EDIT*: Kerrek's clarification.
It is possible to compile a large amount of C++ code developed for VC++ with the MinGW toolchain; however, the ease with which you complete this task depends significantly on how C++-standards-compliant the code is.

If the C++ code utilizes VC++ extensions, such as [`__uuidof`](http://msdn.microsoft.com/en-us/library/zaah6a61.aspx), then you will need to rewrite these portions.

You won't be able to compile ATL & MFC code with MinGW because the ATL & MFC headers utilize a number of VC++ extensions and depend on VC++-specific behaviors:

* [`try`-`except` Statements](http://msdn.microsoft.com/en-us/library/s58ftw19%28v=VS.100%29.aspx)
* `__uuidof`
* [`throw(...)`](http://msdn.microsoft.com/en-US/library/wfa0edys%28v=VS.100%29.aspx)
* Calling a function without forward-declaring it.
* [`__declspec(nothrow)`](http://msdn.microsoft.com/en-US/library/49147z04.aspx)
* ...

You won't be able to use VC++-generated `LIB` files, so you can't use MinGW's linker, `ld`, to link static libraries without recompiling the library code as a MinGW `A` archive.

You *can* link with closed-source DLLs; however, you will need to [export](http://msdn.microsoft.com/en-us/library/d91k01sh%28v=VS.100%29.aspx) the symbols of the DLL as a [`DEF` file](http://msdn.microsoft.com/en-us/library/28d6s79h%28v=VS.100%29.aspx) and [use `dlltool`](http://cygwin.com/cygwin-ug-net/dll.html) to make the corresponding `A` archive (similar to the VC++ `LIB` file for each DLL).

MinGW's inclusion of the w32api project basically means that code using the Windows C API will compile just fine, although some of the newer functions may not be immediately available. For example, a few months ago I was having trouble compiling code that used some of the "secure" functions (the ones with the `_s` suffix), but I got around this problem by exporting the symbols of the DLL as a `DEF`, preparing an up-to-date `A` archive, and writing forward declarations.

In some cases, you will need to adjust the arguments to the MinGW preprocessor, `cpp`, to make sure that all header files are properly included and that certain macros are predefined correctly.

What I recommend is just trying it. You will definitely encounter problems, but you can usually find a solution to each by searching on the Internet or asking someone. If for no other reason, you should try it to learn more about C++, differences between compilers, and what standards-compliant code is.