Tal vez algo así es lo que necesitas...
No acabo de tener claro lo que quieres hacer, pero esto creo que hace lo que pretendes.
Código Delphi
[-]
library My_DLL;
uses
SysUtils,
Classes, windows, Dialogs, ExtCtrls, forms;
type
TestClass = class
private
Tiempo:TTimer;
procedure MyOnTimer(Sender:TObject);
public
procedure init();
end;
var
i:Integer;
t:TestClass;
running:boolean;
{$R *.res}
procedure Finalizar; stdcall;
begin
t.Tiempo.Enabled := False;
running := true;
t.Free;
end;
procedure pruebaTiempo ; stdcall;
begin
t := TestClass.Create();
running := true;
t.init;
end;
procedure TestClass.init;
begin
Tiempo := TTimer.Create(nil);
i:=0;
tiempo.Interval:=2000;
tiempo.OnTimer := MyOnTimer;
tiempo.Enabled:=True;
end;
procedure TestClass.MyOnTimer(Sender: TObject);
begin
inc(i);
ShowMessage(inttostr(i)) ;
end;
exports pruebaTiempo;
exports Finalizar;
end.
(1) El componente puedes crearlo pasando un nil, pues no "pertenece" a ningún formulario.
(2) En cuanto al segundo error te está diciendo que el evento que asignes debe pertenecer a una clase.