delphi 2007 for .net 中 建立DLL,编译时出现错误的解决方法.
2007-12-23 11:07
603 查看
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, 成功.
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, 成功.
相关文章推荐
- Delphi出现“borland license information was found,but it is not valid for delphi”的错误,无法运行的解决方法
- 在VS2012中创建一个MFC动态链接项目(.dll)后,编译出现一大堆莫名其妙的错误的解决方法
- MinGW 编译出现g++: fatal error: -fuse-linker-plugin, but liblto_plugin-0.dll not found错误的解决方法
- asp.net程序编译调试时偶尔出现访问被拒绝的错误的解决方法
- 在Asp.net中建立Microsoft.Office.Interop.Word.Application时出现“拒绝访问”错误的解决方法
- PB for WINCE 6编译时出现错误提示 don't know how to make atlsd.lib 的解决方法 U1073 U1077
- 水晶报表使用经验谈1--建立水晶报表第一步及编译最易出现错误的解决方法及报表转换成pdf文档进行打印方法
- 项目文件.NET下编译C++代码时出现fatal error C1083: 无法打开包括文件:“xuhk_JNIHelloWorld.h”: No such file or directory错误的解决方法。
- asp.net程序编译调试时偶尔出现访问被拒绝的错误的解决方法
- asp.net程序编译调试时偶尔出现访问被拒绝的错误的解决方法
- 采用MingW编译OPENCV,出现recipe for target xxx/can't create precompiled header错误解决方法
- 引用原因.NET下编译C++代码时出现fatal error C1083: 无法打开包含文件:“iostream.h”: No such file or directory错误的解决方法.
- Delphi出现“borland license information was found,but it is not valid for delphi”的错误,无法运行的解决方法
- 当打开Delphi7,出现“borland license information was found,but it is not valid for delphi”的错误,无法运行的解决方法
- 在Asp.net中建立Microsoft.Office.Interop.Word.Application时出现“拒绝访问”错误的解决方法
- Asp.net中建立MS office组件时出现“拒绝访问”和“消息筛选器显示应用程序正在使用中”错误的解决方法
- 启动DELPHI2007出现 EditorLineEnds.ttr 错误的解决方法
- Delphi出现“borland license information was found,but it is not valid for delphi”的错误,无法运行的解决方法
- 在asp.net(vb)中,应用ajaxpro.dll操作Session出现错误的解决方法
- Asp.Net(IIS)运行后出现“.dll拒绝访问”错误的解决方法(已解决)