Skip to main content
gamedev.net
🔒 Locked

DLL exporting template classes

Started by PsyCHo puNk Jul 29, 2001 at 9:27 PM 0 replies 350+ views
Original Post
PsyCHo puNk
PsyCHo puNk
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).
SteveC
SteveC
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.