Mail Archives: djgpp/2001/01/22/09:51:48
Dieter Demerre wrote:
> Can anybody direct me to information about this #export directive ?
The keyword is just export, not #export.
> I consulted the C++-primer and couldn't find anything about it.
Perhaps it's not very up-to-date.
> Are you (Rafal) sure it's part of any standard ?
There's only one standard for C++, and 'export' is defined there in
clause 14 (Templates).
The idea is that you can declare an exported template in a header
file, e.g.:
export template <class T> bool foo(const T&);
And then in some file that includes this header, you define the
template, e.g.:
template <class T>
bool foo(const T& t)
{
return t.bar() || t.baz();
}
Now any file that includes the header file can use the template,
and the compiler will ensure that the required specialisations are
instantiated, even though the template definition may not be visible
to any of the code that uses it.
The above code is untested, of course, due to the absence of
conforming compilers. With DJGPP you will get a warning like
this:
warning: keyword 'export' not implemented and will be ignored
and then a link error.
- Raw text -