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 AddNumber(x,y:integer):integer;stdcall;
begin
    result:=x+y;
end;
function MaxNum(x,y:integer):integer;stdcall;
exports
   AddNumber;
   MaxNum;begin
end.
有个大问题,如果把exports后面的MaxNum去掉就是一切正常啊,但是你一旦加上就出现错误了啊,也就是说这个dll只能够导出一个函数啊,这是什么原因啊!请各位高手指教!!
var
  Form1: TForm1;
  function AddNumber(x,y:integer):integer;stdcall;external 'Project2.dll';
  function MaxNum(x,y:integer):integer;stdcall; external 'Project2.dll';
implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
  edit3.Text := inttostr(AddNumber(strtoint(edit1.text),strtoint(edit2.Text)));
end;procedure TForm1.Button2Click(Sender: TObject);
begin
  edit3.Text := inttostr(MaxNum(AddNumber(strtoint(edit1.text),strtoint(edit2.Text)));
end;

解决方案 »

  1.   

    var
      Form1: TForm1;
      function AddNumber(x,y:integer):integer;stdcall;external 'Project2.dll';
      function MaxNum(x,y:integer):integer;stdcall; external 'Project2.dll';
    implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    begin
      edit3.Text := inttostr(AddNumber(strtoint(edit1.text),strtoint(edit2.Text)));
    end;procedure TForm1.Button2Click(Sender: TObject);
    begin
      edit3.Text := inttostr(MaxNum(AddNumber(strtoint(edit1.text),strtoint(edit2.Text)));
    end;
      

  2.   

    exports
       AddNumber,-------------注意這是用','
       MaxNum;