MinGW:sjlj,warf,seh各版本的区别以及下载地址

Exception handling: SJLJ, DWARF, and SEH

Some packages like MinGW-builds and TDM-GCC let you choose which exception implementation you want to use. You must ensure you use the same compiler used to build the Qt you use in order to avoid linker errors. If you choose to change the exception handling mechanism, you will need to rebuild all code, mostly because the libgcc shared library name is different between the exception handling settings.

SJLJ (setjmp/longjmp):

DWARF (DW2, dwarf-2)

  • available for 32 bit only
  • no permanent runtime overhead
  • needs whole call stack to be dwarf-enabled, which means exceptions cannot be thrown over e.g. Windows system DLLs.

SEH (zero overhead exception)

  • will be available for 64-bit GCC 4.8.
  • rubenvb release is available targetting Win64/Personal Builds/rubenvb/gcc-4.8-release/x86_64-w64-mingw32-gcc-4.8.0-win64_rubenvb.7z/download
  • MinGW-builds release is available

From TDM-GCC readme:

"GCC currently supports two methods of stack frame unwinding: Dwarf-2 (DW2) or SJLJ (setjmp/longjmp). Until recently, only SJLJ has been available for the Windows platform. This affects you, the end user, primarily in programs that throw and catch exceptions. Programs which utilize the DW2 unwind method generally execute more quickly than programs which utilize the SJLJ method, because the DW2 method incurs no runtime overhead until an exception is thrown. However, the DW2 method does incur a size penalty on code that must handle exceptions, and more importantly the DW2 method cannot yet unwind (pass exceptions) through "foreign" stack frames: stack frames compiled by another non-DW2-enabled compiler, such as OS DLLs in a Windows callback.

This means that you should in general choose the SJLJ version of the TDM-GCC builds unless you know you need faster exception-aware programs and can be certain you will never throw an exception through a foreign stack area.

As distributed, the SJLJ and DW2 packages of TDM-GCC can coexist peacefully extracted to the same directory (i.e. any files in common are for all intents and purposes identical), because the driver executables (the ones in the "bin" directory) are suffixed with "-dw2" for the DW2 build, and the libraries and other executables hide in another "-dw2" directory in "lib(exec)/gcc/mingw32". This allows you to use the same single addition to your PATH, and use DW2 exceptions only when you need them by calling "gcc-dw2", etc. If you truly want DW2 exceptions as the default when calling "gcc" (from Makefiles or configury systems, for example), you can rename or copy the suffixed executables to their original names."

DW2 Issues

  • If a library that uses DW2 exception handling (e.g. libgcc_s_dw2-1.dll) is loaded using LoadLibrary and FreeLibrary is not called, the program will crash. See http://comments.gmane.org/gmane.comp.gnu.mingw.user/41724
  • Calling FreeLibrary to unload a dll that links to both dynamic libgcc_s_dw2 and a library that links to static libgcc_s_dw2 results in a crash

GCC Threading model (posix vs win32)

Mingw-Builds (and the experimental rubenvb packages) also let you choose between the threading model internally used by (lib)gcc:

  • posix (built upon MinGW-w64's winpthreads)
    • "an implementation of POSIX threads for win32 is also available under the experimental directory. Its main goal is to support C+11 standard threading, which supports only using POSIX threads at the moment." Mingw-w64
    • enables C11 library features contained in the headers <thread>, <mutex>, and <future>.
    • Performance degradation in specific scenarios. C11 functionality is significantly slower than native Win32 implementation or even MSVS2012's implementation.
  • win32
    • uses native Win32 threading functions.
    • no C11 <thread>, <mutex>, or <future>
    • best performance

More reading: MinGW - Minimalist GNU for Windows / Re: [Mingw-users] enable std::thread experimental patch

原文链接:

MinGW-64-bit

参考文章:

MinGW gcc下载链接及sjlj、dwarf、seh异同以及gcc安装

MinGW-w64各版本—— sjlj seh dwarf 有什么区别?

MinGW下载地址:

MinGW-64

MinGW-32

  • 4
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

百口可乐__

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值