Quote Originally Posted by Darkhog
Thanks, PJP Dev. I'll try it. I will post it on Lazarus forums. Did you notice problems with DB? SMF get something like this very often, so i don't use it (some time ago I had to use it, and this wasn't good experience)

//EDIT: It's give me design-time error exports clause only allowed in libs. Can you post whole unit, please?
//EDIT #2: Silly me - I put exports before initialization.
//EDIT #3: Identifier not found: TLibHandle
First off... I didn't get any problems with SMF on my site yet, but thats a bit off-topic.

Solution for EDIT #1: Comment the exports out while placing components on the form. This is the reason why I suggest making a dynamic library.

Solution for EDIT #2: I did it and it worked for me... Nothing wrong with that.

Solution for EDIT #3: Did you add dynlibs to the uses clause?
[pascal]
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, dynlibs;
[/pascal]
TLibHandle is in dynlibs, so you'll need to add it.

Here is my full source...

[pascal]
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, dynlibs;

type

{ TForm1 }

TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;

var
Form1: TForm1;
adress: TLibHandle;


implementation

procedure Method1;
begin
ShowMessage('Hello world 1');
end;

procedure Method2;
begin
ShowMessage('Hello World 2');
end;

type
TMyMethod = procedure; stdcall;

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
var
mp: TMyMethod;
begin
mp := TMyMethod(GetProcAddress(adress, 'Method1'));

mp;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
mp: TMyMethod;
begin
mp := TMyMethod(GetProcAddress(adress, 'Method2'));

mp;
end;

exports Method1 name 'Method1';
exports Method2 name 'Method2';

initialization
{$I Unit1.lrs}

end.
[/pascal]