Archived

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

PsyCHo puNk

DLL exporting template classes

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
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