On Thu, Jun 1, 2017 at 11:49 AM, bob by <blaoiwn4920...@gmail.com> wrote:
> I linked all libraries statically, before that it depended on
> libgcc_s_dw2-1.dll and libwinpthread-1.dll, and probably something
> else too. It was around 500 KiB originally, now it is almost 1000 KiB.

if your program depends on those DLLs, it means that the libaries
provided by those DLLs were not linked in statically.  A DLL is a
dynamic shared object that gets loaded at runtime, while a static
library is something that gets included into your EXE at link time and
makes your EXE bigger.

> Here is the output of my g++ -v

OK, so you are using GCC 6.3.0, provided by the MSYS2 project.  You
can see how that version of GCC was built and track down its source
code by looking at the build script here:

https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-gcc

> Is it possible to make something that will look like cout << "some
> string", but will just redirect to printf internally and be more
> lightweight? I'm very new to C++ to mess with runtime by myself.

Sure, you can define your own simple class that overrides the left
shift operator and does arbitrary stuff with the arguments.  C++
method overloading would allow you to define different overloads of
the operator that handle the printing of different data types.  I
don't think saving a megabyte of executable size is enough to justify
that effort, especially when you could save that size by using printf.
Also, by making your own cout, you make it harder for other C++
programmers to understand and modify your code.

--David

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to