THYCrossPlatformModule

Overview

The THYCrossPlatformModule is a class that represents a cross-platform module loaded by the Hydra framework.

Use Case

You can use this class 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  override

Creates a new instance of the class.

constructor Create(aModuleManager: THYBaseModuleManager; aFileName: string)

Parameters:

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

CreateInstance  virtual

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

Returns the interface of the current module controller.

property CrossPlatformModuleController: IHYCrossPlatformModuleController read write

ErrorNotHydraModule  protected

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

Allows to load specified function

procedure LoadAsUnmanagedModule(ExportFunctionName: string)

Parameters:

  • ExportFunctionName: Export function name

ModuleController

Returns the current module controller.

property ModuleController: THYSimpleModuleController read write

Plugins

Gets reference to the plugin module controller.

property Plugins[Index: Integer]: THYCrossPlatformPluginDescriptor read write

PluginsCount

Gets the number of plugins inside module.

property PluginsCount: Integer read write

RegisterPlugin  protected virtual

Registers a plugin descriptor in the module.

procedure RegisterPlugin(Plugin: THYCrossPlatformPluginDescriptor)

Parameters:

  • Plugin: Reference to the plugin descriptor.

ReleaseModule  protected virtual

Releases resources of the loaded module.

procedure ReleaseModule

 

CrossPlatformModuleController

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

ModuleController

Returns the current module controller.

property ModuleController: THYSimpleModuleController read write

Plugins

Gets reference to the plugin module controller.

property Plugins[Index: Integer]: THYCrossPlatformPluginDescriptor read write

PluginsCount

Gets the number of plugins inside module.

property PluginsCount: Integer read write

 

constructor Create  override

Creates a new instance of the class.

constructor Create(aModuleManager: THYBaseModuleManager; aFileName: string)

Parameters:

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

CreateInstance  virtual

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

procedure ErrorNotHydraModule

LoadAsUnmanagedModule  protected

Allows to load specified function

procedure LoadAsUnmanagedModule(ExportFunctionName: string)

Parameters:

  • ExportFunctionName: Export function name

RegisterPlugin  protected virtual

Registers a plugin descriptor in the module.

procedure RegisterPlugin(Plugin: THYCrossPlatformPluginDescriptor)

Parameters:

  • Plugin: Reference to the plugin descriptor.

ReleaseModule  protected virtual

Releases resources of the loaded module.

procedure ReleaseModule