delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/12/03/23:45:34

From: khan AT xraylith DOT wisc DOT edu (Mumit Khan)
Subject: Re: help for template woes with g++
3 Dec 1997 23:45:34 -0800 :
Message-ID: <Pine.SUN.3.93.971204010134.22209A-100000.cygnus.gnu-win32@modi.xraylith.wisc.edu>
References: <9712031721 DOT ZM14602 AT typhoon DOT coginst DOT uwf DOT edu>
Mime-Version: 1.0
To: "John F. Kolen" <jkolen AT typhoon DOT coginst DOT uwf DOT edu>
Cc: gnu-win32 AT cygnus DOT com

> Those of you who are struggling with linker errors caused by templates (such
> as those found in STL) might like to know that -frepo works much better when
> combined with -O3.  It turns out that repo stumbles on inlined methods declared
> outside the class.  The -O3 forces the compiler to generate inline code,
> otherwise the compiler _decides_ what to inline and to generate.  See g++ info
> page for more details.
> 

Yes, this is a well-known problem. I believe I did document a few of these
cases a few years in my STL Newbie Guide (now hopelessly outdated). -frepo
has had problems as well, most of which have been fixed in egcs.

fwiw, with egcs-1.0 (and fsf 2.8 when released), this problem goes away,
at least on ELF and PE-COFF (i386). You can just let the compiler
instantiate all the templates it needs, and the linker will throw away the
duplicates.  Basically, the template instances go in named sections with
".linkonce"  attribute, and then linker does the rest. 

Sometime this weekend, I should have egcs-1.0 distribution for gnu-win32.

Regards,
Mumit -- khan AT xraylith DOT wisc DOT edu
http://www.xraylith.wisc.edu/~khan/

-
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