Mail Archives: cygwin/2003/05/16/11:45:39
Hello everybody,
I would like to ask for some advice considering a compiling issue. When
compiling a C++ program that contains STL headers, cygwin g++ seems to
produce overly bloated code, compared to the same version of g++ (3.2)
on other (Linux) plattforms or other compilers (Microsoft Visual C++).
E.g. the following "hello world" program.:
#include <iostream>
int main () { std::cout << "Hello, world!!" << std::endl; return 0; }
Compiled with the command line:
g++ -O2 -Wl,-s hello.cpp -o hello_cpp
produces hello_cpp binaries of the size:
Linux (gcc version 3.2) :
3.756 Bytes
Cygwin (gcc version 3.2 20020927 (prerelease)) : 219.136 Bytes
MSVC++ 7.0 : ca.
3000 Bytes (dont know exactly any more)
I think this issue has crept up before in this mailing list, but none of
the advice given so far seems to apply to/ work with gcc 3.2. Strip.exe
doesn't yield any effect as ld already stripped the executable (-Wl,-s
option). This might not be that much of a problem when producing single
large binaries or using pure C Code, but when having a big set of little
C++ commandline tools the speed offset becomes noticable. I vaguely
remember this is a problem with the Template headers which can't be put
into a dll other than defining a set of heavily used instantiations that
are put into a dll. To be of any value this probably would need to be a
pretty firm feature for the cygwin distribution, so you can make this
dll a prerequisite.
I'd like to ask if anybody has ever done something like that and the
"feature-is-there-you-just-have-to-find-it" or whether it's planned by
the compiler gurus or whether there are principal problems why this will
never work.
Thanks for your attention,
Felix Koehler
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -