我在一个项目中新建了一个单元文件,准备在这个单元文件中定义公用变量和共用函数。那么怎么才能实现在别的单元中调用这个单元的函数?例如PublicUnit.pas中有一个:
 
function readstring(pos:longint):string;
begin
.....
end;然后再Unit1中:.....Uses .........,PublicUnit;
.....begin
form1.caption:=readstring(125412);   //系统提示找不到readstring!@!!
end;我感觉这个问题比较简单,因此分就不多给啦!!
Waiting online......

解决方案 »

  1.   

    将函数圆形在Interface下面重写一遍就可以了
      

  2.   

    同意小Lex的说法。楼顶是一位Pascal不及格者……
      

  3.   

    例如PublicUnit.pas中有一个:
    Interface
    ....................................
    function readstring(pos:longint):string;
    ......................................
     
    function readstring(pos:longint):string;
    begin
    .....
    end;然后再Unit1中:.....Uses .........,PublicUnit;
    .....begin
    form1.caption:=PublicUnit.readstring(125412);   //为防止其他单元声明有相同函数,
                                                    //前面指定单元名
    end;