独立出一个unit,多的话直接写成dll!

解决方案 »

  1.   

    在一个单元中写 
     
    在你的程序中加入 
      uses
        commdcu(公共单元);
      

  2.   

    对,也就是在其他调用这个函数所在的单元中增加 uses XXXX
    XXXX为公共函数所在的单元名称
      

  3.   

    写在public里,然后在别的窗体里uses一下函数所在单元就可以调用了
      

  4.   

    unit commdcu;interfaceimplementationfunction tt(strValue: String): Boolean;
    begin
            Result:=True;
    end;end.但在别的地方use commdcu后,仍不能访问tt,为什么?
      

  5.   

    如果函数数量非常少的话,比如1到2个,你可以将它们写在implementation下面,
    如:
    implementation
      //函数声明
      function MyFunction(s1, s2: String): String;
    {$R *.dfm}function MyFunction(s1, s2: String): String;
    begin
      // your Code
    end;
      

  6.   

    对不起,写错了,应该在implementation上面:  //函数声明
      function MyFunction(s1, s2: String): String;
    implementation{$R *.dfm}function MyFunction(s1, s2: String): String;
    begin
      // your Code
    end;
      

  7.   

    加上函数声明后,在最后一行end.处,提示:BEGIN expected but END found