Sign in to follow this  
SteveDeFacto

extern "C" with template?

Recommended Posts

I'm trying to define a template class inside my library but when I use extern "C" which I use on all other functions and classes I export from my dll I get a syntax error. Why and is there anyway around it?

Share this post


Link to post
Share on other sites
Well, I guess the long and the sort of it is that templates can't have C linkage. To be honest, it really doesn't make sense in the context of templates anyway, since they're compiled when they're used at the call site. The simple solution is that you don't [i]need[/i] to have your templates exported from a DLL file, since the client code should have access to the complete template definition anyway, although there are some caveats. Can you be a little more specific in what you're trying to accomplish?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this