⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interfacedllloader.pas

📁 DLL导出接口演示
💻 PAS
字号:
unit InterfaceDLLLoader;

interface

uses
  Windows, PrjInterface, DLLLoader, SysUtils;

type
  TInterfaceDLLLoader = class(TDLLLoader)
  private
  public
    constructor Create;
    destructor destroy; override;
    function GetInterface: IMyInterface;
    procedure FreeInterface;
  end;

implementation

{ TInterfaceDLLLoader }

constructor TInterfaceDLLLoader.Create;
begin
  inherited Create(GetApplicationPath + '\Dll\Dll.Dll');
end;

destructor TInterfaceDLLLoader.destroy;
begin
  //FreeInterface;
  inherited;
end;

procedure TInterfaceDLLLoader.FreeInterface;
var
  InvokeProc: procedure;
begin
  @InvokeProc := GetProcAddress(DLLHandle, pchar('FreeInterface'));
  if @InvokeProc <> nil then
    InvokeProc;
end;

function TInterfaceDLLLoader.GetInterface: IMyInterface;
var
  InvokeFunc: function: IMyInterface;
begin
  @InvokeFunc := GetProcAddress(DLLHandle, pchar('GetInterface'));
  if @InvokeFunc <> nil then
    result := InvokeFunc;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -