re: c++ template instanciation and dlls on win32

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2007-07-01 at 22:30 +1200, Danny Smith wrote:

> > Here is my sample code: 
> > http://www-sop.inria.fr/dream/personnel/Mathieu.Lacage/tmp.tar.gz
> 
> 
> This is what I would do:
> 
> Exolicitly, force instantiation of your template instance in dll:

ok.

> 
> diff -c3p tmp/test.cc tmp0/test.cc
> *** tmp/test.cc	Sat Jun 30 21:30:22 2007
> --- tmp0/test.cc	Sun Jul  1 15:49:20 2007
> ***************
> *** 1,5 ****
> --- 1,8 ----
>   #include "test.h"
>   
> + // instantiate
> + template class Test <0>;
> + 
>   void Function (void)
>   {
>     Test<0>::Exec ();
> 
> 
> 
> Explictly mark the reference to your imported instantation as imported.

This begs the question as to whether it is possible to automate the
import: can I tell gcc that it should not implicitely generate any
template instanciation and that it should import it instead ? I cannot
see myself having to explicitely import every possible instanciated
template so, I am trying to find a workaround.

I tried to make sure that gcc does not implicitely generate any template
instanciation but -fno-implicit-templates did not seem to achieve
anything: objdump still shows the method body in the object files. Is
there something extra I need to do ? And if I can make the no generation
option work, is there a way to tell gcc to import every non-generated
instanciation ?

sorry if the answer is obvious but I am a bit lost here.

Mathieu


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux