Managing Plugin Modules (Delphi)

Hydra provides several ways to load a plugin module; to load the module you always need a module manager. Depending on used framework, it can be

  • THYSimpleModuleManager - Module manager for console application. Works with plugins via cross-platform interfaces.
  • THYModuleManager - Module manager for VCL hosts. works with plugins via IHYVCL* interfaces. requires runtime packages for using with VCL plugins
  • THYVCLSimpleModuleManager - lightweigh version of module manager for VCL hosts. Works with plugins via crossplatform interfaces.
  • THYFMXModuleManager - Module manager for VCL hosts. works with plugins via IHYFMX* interfaces. requires runtime packages for using with FMX plugins

Most of the methods work in a same way for each these components, so let's review these methods:


ModuleManager.LoadModule('MyModule.dll', false);

Two last methods loads modules specified in the ModulesToLoad property of the module manager.

ModuleManager.LoadModules('*.dll', false);

  • AutoLoad property - Module manager can load modules automatically after its creation, to do this you first need to set a list of module file names in the ModulesToLoad property.


ModuleManager.LoadManagedModule('Net.Plugin2.dll', hcdNewAppDomain);
ModuleManager.LoadManagedModule('Net.Plugin.dll', false);

Unloading Modules

There is no need to manually unload modules since Hydra will do this automatically when the module manager is destroyed, however, module manager provides several methods to preform this task:

Please note that you must release all plugin instances before you unload a module, or you will get an exception.