Reward for implementing Export keyword. [ was: Re: C++ export keyword ]

Ryan McDougall ryan.mcdougall@telusplanet.net
Sat Apr 12 01:06:00 GMT 2003


On Fri, 2003-04-11 at 03:45, Nathan Sidwell wrote:
> Ryan McDougall wrote:
> I do not believe the sun compiler does not support export, if it is doing
> separate compilation of templates, it is using a non-export mechanism.

It is using a non export mechanism. I believe it writes an intermediate
form to SunWS_cache directory, then inserts the proper type at link
time. You can observe this behaviour if you have a Solaris machine.

> 
> You can write source that works with or with out export. The basic idea is
> that you do something like;
> 
> /// file.h
> #if !FILE_H_INCLUDED
> #define FILE_H_INCLUDED 1
> #if !HAVE_EXPORT // this bit should be in a config.h file
> #define export
> #endif
> 
> export template <typename T> void Foo (T);
> 
> #if !HAVE_EXPORT && !FILE_CC_INCLUDED
> #define FILE_CC_INCLUDED 1
> #include  "file.cc"
> #endif
> #endif
> 
> // file.cc
> #if !FILE_CC_INCLUDED
> #define FILE_CC_INCLUDED 1
> #include "file.h"
> #endif
> 
> template <typename T> void Foo (T arg)
> {
>    // do the foo thing
> }
> 
> You may need an auxilary file or something, or else you need to be
> careful what you put in file.cc. This organization also has the advantage
> that users of file.h do not have to look at the implementation when wading
> through the header file to learn the interface.
> 
> Alternatively, -frepo might be what you're looking for.
> 
> nathan

Thank you for your time Nathan. I appreciate your help, but it seems to
be the problem is with the compiler, and it is a serious problem that
forces all signifigant template code into the #include hack. Maybe Im
just to young and naieve to care about whether my code is hacked or not.
:) Is export really that hard to implement, that it has gone 5 years
without being done? If so then ANSI/ISO have made a severe design flaw,
and I should reconsider my high regards fo C++. Is C# the future?

I am willing to put my money where my mouth is. Although I am no good at
compiler hacking, I am willing to donate $1000 canadian to the person
who finally implements this feature. Keep in midn that I am a poor
student who will be using his student loans to finance this bounty.

ONWARD BRAVE HACKERS!! QUASH THIS BUG!! Ill give you $1000  canadian if
you do.

Cheers,
Ryan



More information about the Gcc-bugs mailing list