Is 'export' supported?

Eric Mercer eemercer@yuan.elen.utah.edu
Wed Aug 26 18:14:00 GMT 1998


I'm trying to organize my template code as described in Stroustrup's "C++
Programming Language Third Edition" on page 351.  This setup is as
follows:

// out.h
template<class T> void out(const T& t);

//out.c
#include <iostream.h>
#include "out.h"

export template<class T> void out(const T& t) {std::cerr << t;}

After this, I want to now use the 'out' function in different c files
and with different template parameters as shown below:
below:

// user1.c
#include "out.h"
// use out( int );

// user2.c
#include "out.h"
// use out( string ) 

This paradigm runs into two problem:

   1) The compiler doesn't seem to be recognizing the 'export' keyword.
   2) If the 'export' keyword is omitted, the implemention of the
      different versions of the function 'out' are not created and the 
      program is not able to link because it cannot resolve the function
      calls to the various versions of 'out'.

My question is this:

Is there any way to not completely declare and define templates in the
same file?  ( i.e. Declare the template in 1 file and define the template
in another. )

Also, is the 'export' keyword supported by egcs at all?





More information about the Gcc-bugs mailing list