Mingw-w64, what's the purpose of libgcc_s_seh.dll?

▼魔方 西西 提交于 2020-08-04 05:43:25

问题


Libraries built with Mingw-w64 require those dll:

libwinpthread-1.dll
libstdc++-6.dll
libgcc_s_seh-1.dll

I wonder what's up with that, what each dll does? Especially libgcc_s_seh, is that structured exception handling? I thought mingw couldn't work with seh.

Why mingw requires to always bring those dll with your exe?

I wonder if I'm just wasting my time by not just using visual studio as a windows compiler. It's so bloated though, 9 gb for installation.


回答1:


Especially libgcc_s_seh, is that structured exception handling? I thought mingw couldn't work with seh.

Newer versions of GCC (4.8+ if I'm correct) should support SEH on MinGW.

I wonder what's up with that, what each dll does?

They provide the runtime and standard library.

  • libwinpthread: PThreads implementation on Windows (Threading)
  • libstdc++: C++ Standard Library (C/C++ library functions etc.)
  • libgcc_s_seh: Exception handling (SEH)

Why mingw requires to always bring those dll with your exe?

Because your program uses them. If you write a program without threads, standard library and exception and any OS interaction you wont need them.

These DLL's bring everything you need to run your program. Btw. this is not a MinGW only thing, and happens on other systems / compilers too. Often you just don't note this because the OS already ships the libraries, eg. MSVC libraries are very likely on a Windows machine. Dynamic linking always requires some sort of library files, that are .dll on Windows and .so on Linux.

If you have it available on your system use ldd <your application> to see what libraries are dynamically linked.

You can install these MinGW libraries into the system libraries or somewhere where the OS can find it. This enables your programs to use it and you no longer have to ship it with every application (what avoids duplication).

On the other side another option is to static link them. Unlike dynamic linking, you don't need any DLL; on the downside is a increase of you applications size (as now the three libraries are baked into the exe now).

I wonder if I'm just wasting my time by not just using visual studio as a windows compiler.

This depends on your situation. But probably my answer will give you some more insight.



来源:https://stackoverflow.com/questions/46728353/mingw-w64-whats-the-purpose-of-libgcc-s-seh-dll

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!