W wind1 Unregistered / Unconfirmed GUEST, unregistred user! 2000-10-03 #1 DLL中如何传递引用?请举一例子!如在DLL中用引用传递返回一Pchar!
W windhya Unregistered / Unconfirmed GUEST, unregistred user! 2000-10-03 #3 dll: library test; uses ShareMem, SysUtils, Classes; function test(testchar):integer;export;stdcall; begin Strcopy(test,Pchar('123')); test:=0; end; exports test; begin end. unit unit1; interface uses Sharemem,Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; function test(testChar):integer;stdcall;external 'Project2.dll'; implementation {$R *.DFM} procedure TForm1.Button1Click(Sender: TObject); var s:String; begin setlength(s,100); test(pchar(s)); end; end. 不能加VAR!!
dll: library test; uses ShareMem, SysUtils, Classes; function test(testchar):integer;export;stdcall; begin Strcopy(test,Pchar('123')); test:=0; end; exports test; begin end. unit unit1; interface uses Sharemem,Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; function test(testChar):integer;stdcall;external 'Project2.dll'; implementation {$R *.DFM} procedure TForm1.Button1Click(Sender: TObject); var s:String; begin setlength(s,100); test(pchar(s)); end; end. 不能加VAR!!