3 ms·
The reason given when this same article was discussed on reddit was that library authors need to use the same compiler as their customers. In other words, a GC
by rwmj 15y ago
The reason given when this same article was discussed on reddit was that library authors need to use the same compiler as their customers. In other words, a GCC-compiled Windows DLL is not a drop-in replacement for a MSVC-compiled DLL.
I'm sure this is true for C++ which has a crazily complex ABI for things like classes and exceptions. But is this really the case for plain C? (not in the Linux world AFAIK)
- apaprocki 15y agoJust as a comparison, I've heard that Oracle will most likely adopt GCC's C11 ABI when C11 support is added so that one actually will be able to mix-and-match objects from both compilers.
- DarkShikari 15y agox264 has worked fine in many many MSVC applications, even compiled in minGW with gcc. There are some minor catches: 1. If you want a .lib instead of a .dll, you have to make one yourself separately using a tool. Not a big deal, it's just that gcc does do it for you. 2. No debug symbols, because MSVC doesn't support DWARF/etc. 3. gcc guarantees 16-byte stack alignment on x86_32, but only with respect to the caller; MSVC does not, so the stack may not be aligned as gcc expects it. You can use -mpreferred-stack-boundary to make gcc expect it, or you can just explicitly align the stack, either with the gcc intrinsic (requires ~gcc 4.2) or a small assembly function. There are probably a few others, but overall, it does work; cdecl is cdecl.
- 4ad 15y agoC works fine, I even toyed with a kernel module build using MinGW instead of the WDK. One caveat is that GCC doesn't generate PDB information, the debugging format used by Microsoft tools. Only C++ doesn't work.