THYManagedModule

Overview

The THYManagedModule class is a class that represents a managed plugin module loaded by the Hydra. This class is used internally by the Hydra framework to load and initialize .NET plugins.

Note: There is no need to use this class to load plugin module, instead, you need to use the LoadModule or one of the Load* methods of the THYModuleManager.

Use Case

You won't usualy use this class directly, instead you can use THYModule to gain access to information on a loaded module. For example:

procedure TMainForm.ListLoadedPlugins;
var
  I: Integer;
begin
  PluginListBox.Items.BeginUpdate;
  try
    PluginListBox.Clear;

    for I := 0 to HYModuleManager1.ModuleCount - 1 do
      PluginListBox.Items.Add(HYModuleManager1.Modules[i].FileName);
  finally
    PluginListBox.Items.EndUpdate;
  end;
end;

Location


 

constructor Create (THYBaseModuleManager, string)  override    (declared in THYCrossPlatformModule)

Creates a new instance of the class.

constructor Create(aModuleManager: THYBaseModuleManager; aFileName: string)

Parameters:

  • aModuleManager: Owner
  • aFileName: Path to the plugin module file.

constructor Create (THYBaseModuleManager, string, THYClrDomain)  reintroduce overload

Creates a new instance of the class.

constructor Create(aModuleManager: THYBaseModuleManager; aFileName: string; const aDefaultDomain: THYClrDomain)

Parameters:

  • aModuleManager: Owner
  • aFileName: Path to the plugin module file.
  • aDefaultDomain: Defines default domain. Affects only managed plugin modules.

constructor Create (THYBaseModuleManager, string, Boolean)  reintroduce overload

Creates a new instance of the class.

constructor Create(aModuleManager: THYBaseModuleManager; aFileName: string; const InNewAppDomain: Boolean)

Parameters:

  • aModuleManager: Owner
  • aFileName: Path to the plugin module file.
  • InNewAppDomain: Defines whether plugin module will be loaded in a separate AppDomain. Affects only managed plugin modules.

Assembly

Gets reference to the assembly that stores this plugin.

property Assembly: _Assembly read write

CreateInstance  virtual    (declared in THYCrossPlatformModule)

Creates a new instance of the plugin from Descriptor parameter

function CreateInstance(Descriptor: THYCrossPlatformPluginDescriptor): IInterface

Parameters:

  • Descriptor: Reference to a plugin descriptor.

CreateWrapper  protected    (declared in THYBaseModule)

Calls correspondent method in associated ModuleManager

function CreateWrapper(aPlugin: IDispatch; aDescriptor: THYPluginDescriptor): IInterface

Parameters:

  • aPlugin: Cross-platform plugin instance
  • aDescriptor: Plugin descriptor

CrossPlatformModuleController    (declared in THYCrossPlatformModule)

Returns the interface of the current module controller.

property CrossPlatformModuleController: IHYCrossPlatformModuleController read write

ErrorNotHydraModule  protected    (declared in THYCrossPlatformModule)

procedure ErrorNotHydraModule

FileName    (declared in THYBaseModule)

Returns the file name of a loaded plugin module.

property FileName: string read write

Handle    (declared in THYBaseModule)

Gets the handle of the loaded plugin. Can be unavailable for some plugins.

property Handle: THandle read write

LoadAsUnmanagedModule  protected    (declared in THYCrossPlatformModule)

Allows to load specified function

procedure LoadAsUnmanagedModule(ExportFunctionName: string)

Parameters:

  • ExportFunctionName: Export function name

ManagedController

Returns the current module controller.

property ManagedController: THYManagedModuleController read write

ModuleController    (declared in THYModule)

Gets reference to the THYModuleController that is used to manage this plugin.

property ModuleController: THYModuleController read write

ModuleController    (declared in THYCrossPlatformModule)

Returns the current module controller.

property ModuleController: THYSimpleModuleController read write

Plugins    (declared in THYCrossPlatformModule)

Gets reference to the plugin module controller.

property Plugins[Index: Integer]: THYCrossPlatformPluginDescriptor read write

PluginsCount    (declared in THYCrossPlatformModule)

Gets the number of plugins inside module.

property PluginsCount: Integer read write

RegisterPlugin  protected virtual    (declared in THYCrossPlatformModule)

Registers a plugin descriptor in the module.

procedure RegisterPlugin(Plugin: THYCrossPlatformPluginDescriptor)

Parameters:

  • Plugin: Reference to the plugin descriptor.

ReleaseModule  protected virtual    (declared in THYCrossPlatformModule)

Releases resources of the loaded module.

procedure ReleaseModule

 

Assembly

Gets reference to the assembly that stores this plugin.

property Assembly: _Assembly read write

CrossPlatformModuleController    (declared in THYCrossPlatformModule)

Returns the interface of the current module controller.

property CrossPlatformModuleController: IHYCrossPlatformModuleController read write

FileName    (declared in THYBaseModule)

Returns the file name of a loaded plugin module.

property FileName: string read write

Handle    (declared in THYBaseModule)

Gets the handle of the loaded plugin. Can be unavailable for some plugins.

property Handle: THandle read write

ManagedController

Returns the current module controller.

property ManagedController: THYManagedModuleController read write

ModuleController    (declared in THYModule)

Gets reference to the THYModuleController that is used to manage this plugin.

property ModuleController: THYModuleController read write

ModuleController    (declared in THYCrossPlatformModule)

Returns the current module controller.

property ModuleController: THYSimpleModuleController read write

Plugins    (declared in THYCrossPlatformModule)

Gets reference to the plugin module controller.

property Plugins[Index: Integer]: THYCrossPlatformPluginDescriptor read write

PluginsCount    (declared in THYCrossPlatformModule)

Gets the number of plugins inside module.

property PluginsCount: Integer read write

 

constructor Create (THYBaseModuleManager, string)  override    (declared in THYCrossPlatformModule)

Creates a new instance of the class.

constructor Create(aModuleManager: THYBaseModuleManager; aFileName: string)

Parameters:

  • aModuleManager: Owner
  • aFileName: Path to the plugin module file.

constructor Create (THYBaseModuleManager, string, THYClrDomain)  reintroduce overload

Creates a new instance of the class.

constructor Create(aModuleManager: THYBaseModuleManager; aFileName: string; const aDefaultDomain: THYClrDomain)

Parameters:

  • aModuleManager: Owner
  • aFileName: Path to the plugin module file.
  • aDefaultDomain: Defines default domain. Affects only managed plugin modules.

constructor Create (THYBaseModuleManager, string, Boolean)  reintroduce overload

Creates a new instance of the class.

constructor Create(aModuleManager: THYBaseModuleManager; aFileName: string; const InNewAppDomain: Boolean)

Parameters:

  • aModuleManager: Owner
  • aFileName: Path to the plugin module file.
  • InNewAppDomain: Defines whether plugin module will be loaded in a separate AppDomain. Affects only managed plugin modules.

CreateInstance  virtual    (declared in THYCrossPlatformModule)

Creates a new instance of the plugin from Descriptor parameter

function CreateInstance(Descriptor: THYCrossPlatformPluginDescriptor): IInterface

Parameters:

  • Descriptor: Reference to a plugin descriptor.

CreateWrapper  protected    (declared in THYBaseModule)

Calls correspondent method in associated ModuleManager

function CreateWrapper(aPlugin: IDispatch; aDescriptor: THYPluginDescriptor): IInterface

Parameters:

  • aPlugin: Cross-platform plugin instance
  • aDescriptor: Plugin descriptor

ErrorNotHydraModule  protected    (declared in THYCrossPlatformModule)

procedure ErrorNotHydraModule

LoadAsUnmanagedModule  protected    (declared in THYCrossPlatformModule)

Allows to load specified function

procedure LoadAsUnmanagedModule(ExportFunctionName: string)

Parameters:

  • ExportFunctionName: Export function name

RegisterPlugin  protected virtual    (declared in THYCrossPlatformModule)

Registers a plugin descriptor in the module.

procedure RegisterPlugin(Plugin: THYCrossPlatformPluginDescriptor)

Parameters:

  • Plugin: Reference to the plugin descriptor.

ReleaseModule  protected virtual    (declared in THYCrossPlatformModule)

Releases resources of the loaded module.

procedure ReleaseModule