L
LoveBorland
Unregistered / Unconfirmed
GUEST, unregistred user!
我用Delphi写了一个DLL: 'MYDll2.DLL';
......
function MyPos(subs,s:String):integer;
begin
result:=Pos(subs,s);
end;
exports MyPos;
如果在应用程序中如此调用:
......
function MyPos(subs,s:String):integer;register;external 'MYDll2.DLL';
或function MyPos(subs,s:String):integer;external 'MYDll2.DLL';
......
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption:=IntToStr(MyPos('uubs','s'));
Button1.Caption:=IntToStr(MyPos('s','uubs'));
end;则分别返回正0和4;
如果在应用程序中如此调用:
......
function MyPos(subs,s:String):integer;stdcall;external 'MYDll2.DLL';
或function MyPos(subs,s:String):integer;safecall 'MYDll2.DLL';
......
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption:=IntToStr(MyPos('uubs','s'));
Button1.Caption:=IntToStr(MyPos('s','uubs'));
end;则都返回的是0.为什么?
SafeCall,StdCall,External不就是传递参数的顺序不一样吗?
......
function MyPos(subs,s:String):integer;
begin
result:=Pos(subs,s);
end;
exports MyPos;
如果在应用程序中如此调用:
......
function MyPos(subs,s:String):integer;register;external 'MYDll2.DLL';
或function MyPos(subs,s:String):integer;external 'MYDll2.DLL';
......
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption:=IntToStr(MyPos('uubs','s'));
Button1.Caption:=IntToStr(MyPos('s','uubs'));
end;则分别返回正0和4;
如果在应用程序中如此调用:
......
function MyPos(subs,s:String):integer;stdcall;external 'MYDll2.DLL';
或function MyPos(subs,s:String):integer;safecall 'MYDll2.DLL';
......
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption:=IntToStr(MyPos('uubs','s'));
Button1.Caption:=IntToStr(MyPos('s','uubs'));
end;则都返回的是0.为什么?
SafeCall,StdCall,External不就是传递参数的顺序不一样吗?