This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: interface/implementation: export keyword?
- To: tjw30 at cam dot ac dot uk
- Subject: Re: interface/implementation: export keyword?
- From: Joe Buck <jbuck at synopsys dot com>
- Date: Tue, 27 Oct 98 15:15:01 PST
- Cc: egcs at cygnus dot com
> I'm trying to sensibly separate template definitions/declarations for
> a project I'm writing in C++, as I believe (?) it's good practice to
> separate the interface from the implementation.
The short answer is to put your template declarations in an .h file,
and your template definitions in a .cxx (or .cc) file, and until
egcs supports export, #include the .cxx file as well as the .h file
when you use the templates.
> After reading the egcs info pages and scanning the egcs source (!)
> I'm none the wiser, and I couldn't find this as a FAQ anywhere
> either. I even tried looking at the source of some other C++
> template libraries (STL, blitz++), but they don't appear to be
> enforcing the distinction between interface and implementation at what
> I'd thought was an obvious boundary.
That's because they work with existing compilers.