C++ templates and visibility("hidden")

Christian Parpart trapni@gentoo.org
Sat Apr 9 15:35:00 GMT 2005


On Saturday 09 April 2005 6:27 pm, Stefan Strasser wrote:
> > Okay, I did s,MY_API class,class MY_API. Now, when using colorgcc, I even
> > saw the warning you hinted me :)
> >
> > However, when playing a bit around, I see, that I've to explicitely do:
> >
> > template<class T>
> > void FOO_API TFoo<T>::bar(const T& var) {
> >     std::cout << "TFoo::bar(" << var << ")" << std::endl;
> > }
>
> no you don't.
> I don't know what's wrong with your example but the following works:
[.....]

the difference between your example and my little test-case is/was that you've 
defined API empty when compiling the test program but have defined API with 
__attribute__((visibility("default"))) when compiling the shared object.

That's interesting, as it even works with gcc 3.4.3 and my recent gcc4 
snapshot.

Let's see what my real library sais about this....

Thanks so far,
Christian Parpart.

-- 
Netiquette: http://www.ietf.org/rfc/rfc1855.txt
 17:32:48 up 17 days,  6:39,  1 user,  load average: 0.80, 0.59, 0.57
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20050409/80b13840/attachment-0001.sig>


More information about the Gcc-help mailing list