0

I jave the following interface that must be implemented by a set of DLL libraries I want to dynamically import later:

class ToolboxInterface {

public:

struct ToolboxInfo {
    std::string name;
};

virtual void process() = 0;
virtual void clear() = 0;

};

I want to dynamically load the DLL's as in here, and for that reason I have to force this interface to all my DLLs, as a way of being sure I can use GetProcAddress in all DLL's.

What is the best way of forcing this interface into a DLL project? SHould I not use a class and use some other strategy instead? Or how can I use the class interface?

Community
  • 1
  • 1
manatttta
  • 3,054
  • 4
  • 34
  • 72
  • Write an in-process COM DLL. – Richard Critten Jan 26 '15 at 18:00
  • @RichardCritten thank you. could you please ellaborate? – manatttta Jan 26 '15 at 18:02
  • It is not a good idea to use C++ classes as plugin interface unless you can guarantee all the components are built with the same compiler with same settings. Use of C++ standard library classes in interface unfortunately is especially tricky due to its template implementation - not only runtime used should match but even minor additional define like [_ITERATOR_DEBUG_LEVEL](https://msdn.microsoft.com/en-us/library/hh697468.aspx) may break binary compatibility. – dewaffled Jan 26 '15 at 20:51
  • @frymode thanks that's a good point. So should I just keep standard C function reference? – manatttta Jan 27 '15 at 09:56

0 Answers0