library MyDLL;
{$R *.res}

uses
  SysUtils {для функции Beep}, Forms {для переменной Application},
  UMyDialog in 'UMyDialog.pas' {Form1};

procedure DoBeep;stdcall;
begin
Beep;
end;

function Code(S: PChar; Key: integer): PChar; stdcall;
var i: integer;
    ss: string;
begin
 ss := S;
 for i:=1 to Length(S) do
  ss[i] := char(Ord(ss[i]) xor Key);
//  ss[i] := char(Ord(ss[i]) xor (Key + i mod 3));
 Code := PChar(ss);
end;

function MyDialog(User: PChar): PChar; stdcall;
var Form: TForm1;
begin
 Form := TForm1.Create(Application);
 Form.Edit1.Text := User;
 Form.ShowModal;
 Result := PChar(Form.Edit1.Text);
 Form.Free;
end;

exports
 DoBeep,
// DoBeep index 1,
// DoBeep name 'Beep',
 Code,
 MyDialog;

end.


