interface/implementation: export keyword?
Joe Buck
jbuck@synopsys.com
Tue Oct 27 16:33:00 GMT 1998
> 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.
More information about the Gcc
mailing list