hanmyohtwe / waitzar

Automatically exported from code.google.com/p/waitzar
Other
0 stars 0 forks source link

MinGW links a lot of things dynamically. #186

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
MinGW tries to link their "gcc" library (and "std" library) dynamically. This 
will crash if the corresponding DLLs aren't included with the EXE.

Of course, this raises the size of WaitZar.exe to 2.5 MB.

If we replace the "-static-libstdc++ -static-libgcc" linker flags with simply 
"-static" (forcing ALL libraries to link statically) then the file size remains 
at 2.5 MB, implying that "gcc" and "std" are the only libraries linked 
dynamically. (I don't really know how to use "ld" on an EXE...)

If we link dynamically and include "libgcc_s_dw2-1.dll" with the release, then 
program complains about "libstdc++-6.dll". If we include both DLLs, then Wait 
Zar runs. 

These two DLLs total ~900KB, so statically linking (+600KB) is not too bad. I 
dislike the additional size, but that's how it stands. 

This bug report will exist to explore any alternative options. I don't mind 
packaging DLLs, as long as there's a built-in, static default. 

Original issue reported on code.google.com by seth.h...@gmail.com on 15 Jan 2011 at 4:51

GoogleCodeExporter commented 8 years ago
Linking statically disables proper exception handling across DLL boundaries. 
It's easy to work around (we do it with V8), but it requires a bit of care 
nonetheless. 

Original comment by seth.h...@gmail.com on 25 Jan 2011 at 8:05