libray test;
uses
sharemem,
sysutils,
classes,
activex;
function getstr:string;
begin
result:='helll';
end;
exports
getstr;
begin
end;
以上这段代码,在delphi 7中没有任何错误提示,然而在d2007中出现错误提示:
[DCC Error] test.dpr(17): E2395 Unsafe procedure only allowed if compiling with {$UNSAFECODE ON}
意思就是说如果编译不安全的"过程或函数"只能在{$UNSAFECODE ON} 下.所以以上代码要这样写:
libray test;
uses
sharemem,
sysutils,
classes,
activex;
function getstr:string;
begin
result:='helll';
end;
{$UNSAFECODE ON}
exports
getstr;
begin
end;
Ctrl+F9,OK, 成功.