This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: win32 dlls and template instanciations
- From: Mathieu Lacage <Mathieu dot Lacage at sophia dot inria dot fr>
- To: binutils at sourceware dot org
- Date: Tue, 03 Jul 2007 00:06:17 +0200
- Subject: Re: win32 dlls and template instanciations
- References: <1183385878.4539.37.camel@garfield.inria.fr>
On Mon, 2007-07-02 at 16:17 +0200, Mathieu Lacage wrote:
> I thus tried to re-compile my program with -fno-implicit-templates but
> this did not eliminate template instanciation: the dll and the main
> binary still contain a copy of the template. Is there something special
> I should know about this option ?
That option must be used with -fno-implicit-inline-templates in my case
but, as pointed out elsewhere, this was really a gcc problem, not a
linker problem.
> If I could make this option work, I would still need to make my main
> binary import all template instances. Danny Smith helpfully suggested
> the following syntax to perform explicit template instanciation import:
>
> + // Import rather than instantiate
> + extern template class __declspec (dllimport) Test <0>;
>
> But I cannot imagine myself having to import all potential template
> instanciations by hand: is there a way to tell ld to automatically
> import all the templates it does not instanciate ?
and playing a bit with this once I solved the problem above shows that
the toolchain's default behavior is to actually import all
non-instantiated templates. So, the question was moot.
sorry about the noise,
Mathieu