34#define WIN32_LEAN_AND_MEAN
36#undef WIN32_LEAN_AND_MEAN
37#define DLLEXPORT __declspec( dllexport )
45#define EXPORT_PLUGIN( classname, ... ) \
48 DLLEXPORT DSPatch::Component* Create() \
50 return new classname( __VA_ARGS__ ); \
75 explicit Plugin(
const std::string& pluginPath );
78 bool IsLoaded()
const;
80 Component::SPtr Create()
const;
85 void* _handle =
nullptr;
86 Create_t _create =
nullptr;
89inline Plugin::Plugin(
const std::string& pluginPath )
93 _handle = LoadLibrary( pluginPath.c_str() );
95 _handle = dlopen( pluginPath.c_str(), RTLD_NOW );
102 _create = (Create_t)GetProcAddress( (HMODULE)_handle,
"Create" );
104 _create = (Create_t)dlsym( _handle,
"Create" );
110 FreeLibrary( (HMODULE)_handle );
120inline Plugin::~Plugin()
126 FreeLibrary( (HMODULE)_handle );
134inline bool Plugin::IsLoaded()
const
140inline Component::SPtr Plugin::Create()
const
144 return Component::SPtr( _create() );
Abstract base class for DSPatch components.