200大洋呵呵,以下代码测试通过library Prjdll;{ 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 TMyIntResult = array of Integer; PMyIntResult = ^TMyIntResult;procedure TestDll(VAR Rst: PMyIntResult); stdcall;var I: integer;begin SetLength(Rst^, 10); for i := 0 to 9 do Rst^ := i;end;exports TestDll;end.-------------------------------------unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TMyIntResult=Array of Integer; PMyIntResult = ^TMyIntResult; TForm1 = class(TForm) Button1: TButton; Memo1: TMemo; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);type TestDll = procedure(VAR Rst: PMyIntResult); stdcall;var DllHandle: THandle; Dllfarproc: TestDll; MyRst: PMyIntResult; i:Integer;begin DllHandle := LoadLibrary('Prjdll.dll'); if DllHandle > 32 then try Dllfarproc := GetProcAddress(DllHandle, 'TestDll'); new(MyRst); if assigned(DllfarProc) then DllfarProc(MyRst); for I:=low(MyRst^) to High(MyRst^) do Memo1.Lines.Add( Inttostr(MyRst^) ); finally FreeLibrary(DllHandle); end;end;end.