unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type
  TForm1 = class(TForm)
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;
//在这里定义implementation{$R *.DFM}end.然后在其它form中uses unit1就可以使用你定义的变量 如果调用dll
  function DisableMouseHook:Boolean; stdcall; external 'Project1.dll' name 'DisableMouseHook';调用project1.dll中的disablemousehook过程。

解决方案 »

  1.   

    to netlib(河外孤星) :
          你誤會我的意思了,我是說在開發Dll時怎樣在Dll內部定義一個全局變量.供該dll內部的function調用.所說的function問題也是這樣
      

  2.   

    这样好了;
    unit XXXXXX;
    interface
    uses
      Windows, Messages, SysUtils, Controls, StdCtrls;
    type
      .....
    var 
      声明全局变量;
    function .......
    当然这是在dll中use了另外一个unit,如果就在那个dll中写也是一样的。
      

  3.   

    library Project1;{ 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;var
    //定义变量就可以用
    {$R *.RES}begin
    end.
    你把过程也在另一个单元,然后在implementation前面声明一下。
      

  4.   

    全局变量也可以在implementation前声明