| 
 | 
 
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册  
 
x
 
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} 
 
Function max(x,y,z:integer):integer;StdCall; 
var 
t: integer; 
begin 
if(x<y) then 
 t:=y 
else 
 t:=x; 
 
 if(t<z) then 
 t:=z 
else 
 max:=t; 
end; 
 
Function min(x,y,z:integer):integer;StdCall; 
var 
t: integer; 
begin 
if(x>y) then 
 t:=y 
else 
 t:=x; 
if(t>z) then 
 t:=z 
else 
 min:=t; 
end; 
exports 
max,min; 
begin 
end.
2个提示而已。不过话说,这是你自己写的代码吧。不要把责任推给小甲鱼老师。 
一个函数要在 任何时候都有返回值。比如说你这个
 - Function max(x,y,z:integer):integer;StdCall;
 
 - var
 
 - t: integer;
 
 - begin
 
 -   if x<y  then
 
 -     t:=y
 
 -   else
 
 -     t:=x;
 
  
-   if t<z  then
 
 -     t:=z;
 
  
-   max:=t;
 
 - end;
 
  复制代码 
对比下,你的函数保证能在任何情况下都有返回值吗?  
 
 
 |   
 
 
 
 |