ezEngine  Milestone 7
Plugin.h File Reference
#include <Foundation/Utilities/EnumerableClass.h>
#include <Foundation/Strings/String.h>
#include <Foundation/Strings/StringBuilder.h>
#include <Foundation/Communication/Event.h>

Go to the source code of this file.

Classes

class  ezPlugin
 ezPlugin allows to manage all dynamically loadable plugins. Each plugin DLL must contain one global instance of ezPlugin. More...
 
struct  ezPlugin::PluginEvent
 The data that is broadcast whenever a plugin is (un-) loaded. More...
 

Macros

#define EZ_DYNAMIC_PLUGIN_DECLARATION(LINKAGE, Plugin)
 Insert this into a common header file of a plugin that is typically loaded dynamically, to enable easy integration for static linking as well. More...
 
#define EZ_DYNAMIC_PLUGIN_IMPLEMENTATION(Plugin)   void ezPluginHelper_##Plugin() { }
 The counter part to EZ_DYNAMIC_PLUGIN_DECLARATION. Must be put into some cpp file of a plugin.
 

Macro Definition Documentation

#define EZ_DYNAMIC_PLUGIN_DECLARATION (   LINKAGE,
  Plugin 
)
Value:
\
LINKAGE void ezPluginHelper_##Plugin(); \
\
class ezDynamicPluginHelper_##Plugin \
{ \
public: \
ezDynamicPluginHelper_##Plugin() \
{ \
ezPluginHelper_##Plugin(); \
} \
}; \
\
static ezDynamicPluginHelper_##Plugin ezPluginHelperVar \

Insert this into a common header file of a plugin that is typically loaded dynamically, to enable easy integration for static linking as well.

This macro will declare some dummy variable to ensure that a plugin is always referenced (and thus linked into an application), if that header with the declaration in it has been included in an application. This enables integrating a library which is typically loaded dynamically, statically into an application.

Note that once the header that contains this macro has been included, the static reference is always there and thus linking to the library is inevitable. If the library should be loaded dynamically, the application shouldn't even include any of its headers.

This macro also ensures that a plugin DLL exports any symbols at all, which is necessary on Windows to have a .lib and .exp file generated, which is in turn required to statically link against the library.