关于Delphi调用C的接口有关问题

关于Delphi调用C的接口问题我现在写了一个C语言的接口:#ifdef MONTITOR_DLL_EXPORT#define MONITOR_EXPORT

关于Delphi调用C的接口问题
我现在写了一个C语言的接口:
#ifdef MONTITOR_DLL_EXPORT
#define MONITOR_EXPORT __declspec(dllexport)
#else  
#define MONITOR_EXPORT __declspec(dllimport)
#endif

extern "C"
{
  MONITOR_EXPORT int HelloWorld(int age);
}

我的DLL名称是abc.dll

我现在想在Delphi中调用这个接口,我先把DLL文件拷贝到Delphi的工程里面,然后申明如下:
type
  function HelloWorld(int age):integer;cdecl;external 'abc.dll';

然后在
procedure TForm2.Button1Click(Sender: TObject);
var
t : integer;
m : integer;
begin
  t := 10;
  m := HelloWorld(t);
end;

但是这样做报错了:

[DCC Error] Unit1.pas(63): E2169 Field definition not allowed after methods or properties
请问是什么原因呢?


[解决办法]
function HelloWord(m: integer):integer;cdecl;external 'abc.dll'

var
Form2: TForm2;

声明不要放类里面。