Original Post
🔒 Locked
DLL classes
Advertisement
Yeah, I figured that out a while ago...
However, I don''t want to write my own container class either. The article you mentioned said that several STL containers (std::list) were not exportable. It also mentioned that the templated class must be instianted first... does that mean that I have to create a ''dummy'' variable for each possible value!?!
Augh... or I could use void *, but that''s really bad...
However, I don''t want to write my own container class either. The article you mentioned said that several STL containers (std::list) were not exportable. It also mentioned that the templated class must be instianted first... does that mean that I have to create a ''dummy'' variable for each possible value!?!
Augh... or I could use void *, but that''s really bad...
As I said, the prefered solution is to refactor your code. One way is to define an interface class with the functionality you desire that exposes none of it''s implementation, and have the DLL return a pointer to a derived class rather than the original class. Alternately you can emply pimpl, etc.
As for the instantiation questions, instantiation doesn''t necessarily mean declaring a variable of the template type (though that is one way to cause instantation). The instantiation method mentioned in that article is the via the
EXPIMP_TEMPLATE template class DECLSPECIFIER std::vector<MyClass>; line in the source code. This line declares that the code for the class should be generated and exported from the DLL.
As for the instantiation questions, instantiation doesn''t necessarily mean declaring a variable of the template type (though that is one way to cause instantation). The instantiation method mentioned in that article is the via the
EXPIMP_TEMPLATE template class DECLSPECIFIER std::vector<MyClass>; line in the source code. This line declares that the code for the class should be generated and exported from the DLL.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement