I'm getting "Unresolved External Symbols" when I'm inheriting directly from shared library class template, but if I specialize library template in my code first, it works fine.
Template class in shared library:
template <typename T>
class EventHandler
{
public:
virtual ~EventHandler();
virtual EventResult ReceiveEvent(T * evn, EventDispatcher<T> * dispatcher) = 0;
};
Derived class in my code (doesn't work without specialization):
class MyEventHandler : public EventHandler<SomeEventType>
{
public:
virtual EventResult ReceiveEvent(SomeEventType * evn, EventDispatcher<SomeEventType> * dispatcher);
};
Specialized library template class in my code:
template <>
class EventHandler<SomeEventType>
{
public:
virtual ~EventHandler() {}
virtual EventResult ReceiveEvent(SomeEventType * evn, EventDispatcher<SomeEventType> * dispatcher) = 0;
};
I tried reproducing it directly in shared lib's code (I have the source) and it worked fine without template specialization. Does it have anything to do with lib not giving access to full class implementation? In this case EventHandler template doesn't have any additional definitions in .cpp because it's just one pure virtual method.
Also my derived classes are inside the namespace if it matters.
[EDIT] class template of EventHandler
doesn't have any additional implementation in .cpp file, this definition posted above from .h file is everything it does (one pure virtual function). It has nothing to do with thread suggested as possible duplicate.