This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ templates and visibility("hidden")


Hi all,

I'm not sure that I ran into a bug, but I'm quite sure about that -
because the other way around just looks ugly.

When using CXXFLAGS="-fvisibility=hidden" and declaring the following in a 
file for a shared library:

#define MY_API __attribute__((visibility("default")))

template<class T>
MY_API class U {
public:
    void f(T v);
};

and now using U<int> u; u.f(4); in a program source file results into an 
unresolved symbol, f. Well, When the whole thing is *not* a template class, 
it just works fine. Although, when I prefix all members (f) with MY_API as 
well, it do not get a problem, too. But doing so looks just ugly and 
although, just looks like being a bug (I got told that MSVC things so as 
well).

I've made a little (auto-tooled) demo package that demonstrates this `bug` 
containing a README that describes in detail what to do whith this little 
demo package.

I'd be happy if someone can help me out here, since I feel really mad with 
this situation.

Regards,
Christian Parpart.

-- 
Netiquette: http://www.ietf.org/rfc/rfc1855.txt
 02:20:26 up 14 days, 15:26,  0 users,  load average: 0.15, 0.18, 0.18

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]