delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/06/17/20:24:50

From: khan AT xraylith DOT wisc DOT edu (Mumit Khan)
Subject: RE: Newbie template linking problem
17 Jun 1998 20:24:50 -0700 :
Message-ID: <Pine.HPP.3.96.980617152629.20943B-100000.cygnus.gnu-win32@hp2.xraylith.wisc.edu>
References: <c=US%a=_%p=NASD%l=RKV_SRV_EXC-980617200524Z-322459 AT rkv_srv_exch3 DOT rkv DOT nasd DOT com>
Mime-Version: 1.0
To: "Berns, Brian" <BernsB AT nasd DOT com>
Cc: "'gnu-win32 AT cygnus DOT com'" <gnu-win32 AT cygnus DOT com>

On Wed, 17 Jun 1998, Berns, Brian wrote:

> Thanks.  I am now successfully using egcs to compile and link my C++
> program.  My question now is: Should I be using the -frepo option?  When
> I do, I get linker errors.  When I don't, everything links and runs
> fine, but the resulting executable is quite large (esp. in comparison to
> the corresponding .exe produced by VC++) -- I wonder if it contains
> redundant template instantiations?  The archive info on this topic seems
> somewhat muddled.  What's the current behavior?
> 

-frepo is unnecessary on platforms using either ELF (Linux, Solaris 2.x,
....) and PE-COFF (Win32). Also, -frepo doesn't work correctly on cygwin32 
without a few patches, and I don't remember what the status was in the 
egcs-1.0.2 for cygwin32. On other platforms, such as SunOS 4.1.x etc, it
can be a big win (I personally use explicit instantiation, and prefer it
over -frepo. Search dejanews for many articles on this top in gnu.g++.help
and thereabouts).

On both ELF and PE-COFF, the linker discards the duplicate templates, so 
you end up with the "optimal" template code in your final executable. The 
code bloat you're seeing might be just debugging symbols (does "strip" 
help?). There should be no redundant template instances on these
platforms.

For any variant of GCC, I recommend either explicitly instantiating
templates (a royal pain the first time around) or if you're using egcs 
or gcc-2.8.x on ELF/PE-COFF, then using automatic instantiation.

Mumit

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019