library Project2;
uses
  SysUtils,
  Classes;{$R *.res}
var
  i: integer;function myfuc1():integer;function myfuc():integer;
begin    Result := myfuc1();
end;function myfuc1():integer;
begin
    Result := 0;
end;
begin
end.
编译错误提示信息[Error] Project2.dpr(29): ';' expected but '.' found
[Error] Project2.dpr(31): Declaration expected but end of file found

解决方案 »

  1.   

    library Project2;
    uses
      SysUtils,
      Classes;{$R *.res}
    var
      i: integer;function myfuc1():integer;stdcall;
    begin
      Result := 0;
    end;
    function myfuc():integer;stdcall;
    begin  Result := myfuc1();
    end;exports
      myfuc;beginend.
      

  2.   

    上面的代码写错了,从新编辑了下,其实就是上面的先定义函数调用下面后定义的函数
    所以需要在第一个函数前面做一个声明library Project2;
    uses
      SysUtils,
      Classes;{$R *.res}
    var
      i: integer;  function myfuc():integer;stdcall;function myfuc1():integer;stdcall;
    begin
      Result := myfuc();
    end;
    function myfuc():integer;stdcall;
    begin  Result := 0;
    end;
    beginend.
      

  3.   

    因为你的函数实现也是全局的,不需要提前申明的。
    library PTest;{ 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 MyFunc: Integer; stdcall;
    begin
      Result := 20;
    end;exports
        MyFunc;
    beginend.
      

  4.   

    最近也在学习dll 还没入门
      

  5.   

    调用单元 要引用 ShareMem 
      

  6.   


    library Project1;
    uses
      SysUtils,
      Classes;{$R *.res}
    var
      i: integer;
    function myfuc():integer;stdcall;
    begin
      Result := 0;
    end;function myfuc1():integer;stdcall;
    begin
      Result := myfuc();
    end;exports
    myfuc, myfuc1;beginend.