Jump to content
  • Advertisement
Sign in to follow this  
SteveDeFacto

extern "C" with template?

This topic is 2712 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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 need 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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!