• Advertisement

Archived

This topic is now archived and is closed to further replies.

DLL exporting template classes

This topic is 6048 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

Is it possible to export a template class from a standard WIN32 dll? I''ve tried it and I gather it can''t be done (either that or im not doing it right).

Share this post


Link to post
Share on other sites
Advertisement
I''m guessing you are using VC++ 6.0
( Because Borland C++ Builder 5.0 does it without a hitch )

VC++ is very picky about exported classes and templates, including member variables of classes that are exported.

Basically, VC++ allows you to export template instantiations. ( As does C++Builder )

But the must be EXPLICIT instantiations e.g.

template class __declspec(dllexport) std::vector;

To export a vector of longs.

Look it up on MSDN or online help - there''s info on exactly how to do it.

Share this post


Link to post
Share on other sites

  • Advertisement