动态连接库工程的内容如下:
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;function To10(a1 : Integer) : word;stdcall;
begin
 a1 := a1 * 10 + 4;
 result := a1;
end;
{$R *.res}
exports
  to10;
begin
end.
 调用DLL的EXE文件内容如下:
program P1;uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};{$R *.res}begin
  //Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end
unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;function To10(a1 : Integer) : word;stdcall;
implementation{$R *.dfm}
function to10; external 'Project2.dll' name 'to10';
procedure TForm1.Button1Click(Sender: TObject);
var
  str : integer;
begin
  str := strtoint(edit1.Text);
  edit2.Text := inttostr(to10(str));
end;end.先编译DLL,编译通过,生成project2.dll;
然后 我运行exe文件。其中EXE文件中调用了 dll,问错在哪里?