Пытаюсь создать библиотеку и подключить ее динамически! Уже сто раз все проверила. Не получается!!! Вот библиотека:
library Project2;
{ 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 SysUtils, Classes;
{$R *.res} TYPE nd= ^node; node= record inf1: integer; inf2: string[20]; left: nd; right: nd; end;
procedure kol_sheet(var a:nd; i, nur: integer; var k:integer);StdCall; begin if a<>nil then begin kol_sheet(a^.left, i+1, nur, k); if (i=nur) and (a^.left=a^.right) then inc(k); kol_sheet(a^.right,i+1, nur, k); end; end; EXPORTS KOL_SHEET ; end.
type nd= ^node; node= record inf1: integer; inf2: string[20]; left: nd; right: nd; end; Tkol_sheet=procedure(var a:nd; i, nur: integer; var k:integer);StdCall;
TForm4 = class(TForm) procedure Button10Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form4: TForm4; KOL_SHEET: TKOL_SHEET; implementation
uses Unit2, Unit3, Unit1;
{$R *.dfm}
procedure TForm4.Button10Click(Sender: TObject); var k,nur,H: integer; begin try K:=0; strtoint(edit5.Text); If (edit5.Text='') then showmessage('Введите данные!') else begin H:=loadLibrary ( 'PROJECT2.DLL'); IF H<>0 THEN BEGIN @KOL_SHEET := getProcAddress ( H, 'KOL_SHEET' ); if @KOL_SHEET <> nil then kol_sheet(root,i,nur,k); FreeLibrary(h); END; Edit6.text:=inttostr(k); end; except showmessage('Неправильный ввод!'); end; END;