library Pierwsza;

{ Important note about DLL memory management: ShareMem must be the
  first unit in your library's USES clause AND your project's (select
  Project-View Source) USES clause if your DLL exports any procedures or
  functions that pass strings as parameters or function results. This
  applies to all strings passed to and from your DLL--even those that
  are nested in records and classes. ShareMem is the interface unit to
  the BORLNDMM.DLL shared memory manager, which must be deployed along
  with your DLL. To avoid using BORLNDMM.DLL, pass string information
  using PChar or ShortString parameters. }

uses
  Dialogs,
  Windows,
  Graphics;
  {$R *.res}

var
   ACanvas : TCanvas;   // tylko wskaźnik


procedure Rysuj(parCanvas: TCanvas); stdcall;
begin
   ACanvas := parCanvas;

   ACanvas.Rectangle(80, 80, 200, 200);
   ACanvas.Rectangle(280, 280, 400, 400);
end;

function GetLibVersion() : PChar; stdcall;
var
   wersja : String;

begin
	wersja := '1.1';
   Result := PChar(wersja);
end;

procedure GetNI(var nazwisko: PChar; var imie : PChar); stdcall;
begin
	nazwisko := 'Kowalski';
   imie     := 'Adam';
end;

function Kwadrat(cyfra : Integer) : LongInt; stdcall;
begin
	Result := cyfra * cyfra;
end;

exports
   Rysuj         name 'Rysuj',
   GetLibVersion name 'GetLibVersion',
   GetNI         name 'GetNI',
   Kwadrat       name 'Kwadrat';

begin

end.

