在Delphi工程目录新建一个abc.txt文件,内容如下:
const
data : String = '我的数据';
var
n: integer;
procedure sum(a,b:integer);
begin
n:=a+b;
end;
在Delphi的pas文件中加入{$I abc.txt}。这时就可以在加入{$I abc.txt}的pas文件中使用如下的代码了:
showmessage(data);
sum(4, 5);
showmessage(inttostr(n));
这个功能在Delphi的本地版本也好使,有兴趣的读者可以试试。