转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 软件开发 >> Delphi程序 >> 正文
Delphi for .Net 编译器预览 - by John Kaster         ★★★★
Real48 six byte floating type   GetMem(), FreeMem(), and ReallocMem() Use dynamic arrays, or rely on automatic dispose pattern implementation BlockRead(), BlockWrite()   Absolute directive, Addr, and @   Pre-Delphi object syntax (type foo = object)   TVarData, Variant internals Variant semantics will be supported but not as TVarDataFile of <type> This construct cannot be implemented because the Delphi compiler cannot know the size of <type> on the target platform (e.g. a handheld device). The JIT compiler for the specific platform determines the size of intrinsic types. Untyped var and out parameters Untyped const parameters are still supported PChar In a future release Delphi for .NET will support unsafe managed code (i.e. pointers). Unsafe, unmanaged pointers are not supported in the preview release. automated and dispid directives   Inline assembly - asm statement   TInterfacedObjectAddRef, QueryInterface, and Release are deprecated. In the preview release TInterfacedObject is an alias for TObject. Dynamic aggregation Dynamic aggregation of interfaces is not supported by the CLR, because it cannot be statically verified. In Delphi for .NET, all interfaces must be declared on the type. Dynamic aggregation is provided by the implements keyword, as the following code illustrates.

program Project1;

type
  i = interface
    procedure Wombat;
  end;

  TA = class(TInterfacedObject, i)
    procedure Wombat;
  end;

  TC = class(TInterfacedObject, i)
    fa: TA;
    property a: TA read fa implements i;
  end;

{ TA }

procedure TA.Wombat;
begin

end;

begin

end.
ExitProc  

CLR and Delphi

The new Delphi compiler will provide access to the .NET CLR (Common Language Run-time). Delphi developers will be instantly familiar with the CLR not just because it resembles the VCL so clo

上一页  [1] [2] [3] [4]  下一页


[C语言系列][C#防止反编译].NET 产品版权保护方案 (.NET源码加…  [互联动态].NETFramework3.0新特性介绍与问答翻译
[Web开发]asp.net代码空格显示为……点号的原因及解决办法  [Web开发]asp.net调用压缩软件对文件进行压缩与解压缩的代码
[Web开发]详细介绍asp.net获取日期时间的各种格式的函数  [Web开发]如何将JS文件编译到ASP.NET项目里的DLL文件中
[Web开发]asp.net加密口令的最简单方法  [Web开发]目前asp.net开发主流工具软件介绍
[Web开发]asp.net中的反射介绍  [Web开发]制作留言板不使用数据库之asp.net操作XML文件的代…

Delphi for .Net 编译器预览 - by John Kaster

作者:闵涛 文章来源:闵涛的学习笔记 点击数:3209 更新时间:2009/4/23 18:39:15
em := TMenuItem.Create; AboutItem := TMenuItem.Create; MainMenu.MenuItems.Add(FileItem); MainMenu.MenuItems.Add(HelpItem); FileItem.MenuItems.Add(ExitItem); FileItem.Text := ''''File''''; ExitItem.Text := ''''Exit''''; ExitItem.add_Click(ExitItemClick); HelpItem.MenuItems.Add(AboutItem); HelpItem.Text := ''''Help''''; AboutItem.Text := ''''About...''''; AboutItem.add_Click(AboutItemClick); DoitButton := TButton.Create; with DoitButton do begin Left := 8; Top := 8; Width := 33; Height := 25; Text := ''''Go''''; add_Click(DoitButtonClick); end; CelsiusEdit := TSpinEdit.Create; with CelsiusEdit do begin Left := 48; Top := 8; Width := 177; Value := FloatToDecimal(100); Maximum := FloatToDecimal(10000); Minimum := FloatToDecimal(-1000); add_ValueChanged(DoitButtonClick); end; ResultList := TListBox.Create; with ResultList do begin Left := 8; Top := 40; Width := 217; Height := 217; end; ClientSize := System.Drawing.Size.Create(240, 270); Menu := MainMenu; Controls.Add(DoitButton); Controls.Add(CelsiusEdit); Controls.Add(ResultList); Text := ''''ConvertIt!''''; ControlBox := True; MinimizeBox := True; Convert; end; begin Form1 := TForm1.Create; TApplication.Run(Form1); end.

Note! The unit Borland.Delphi.Conversions contains the various Celsius temperature conversion routines. The unit Borland.VCL.Controls is a preliminary version that will not be included with the initial preview release.

The source code listed above is contained in ConvertIt.dpr, and is sure to change even before we ship the .NET preview compiler with Delphi 7. If we compile it, we''''ll see:


[d:d4.netconvert.net]dccil ConvertIt.dpr
Borland Delphi Version 16.0
Copyright (c) 1983,2002 Borland Software Corporation
Confidential pre-release version built Aug  2 2002 17:29:33
Borland.Delphi.Conversions.pas(60)
Borland.Vcl.Controls.pas(38)
ConvertIt.dpr(159)
260 lines, 0.64 seconds, 12232 bytes code, 0 bytes data.

After compiling the application, of course we should run it. Here''''s what the application looks like after a little resizing to minimize the image size.

Fully Managed Code

This application is a 100% managed code application, as the results of PEVerify show:


[d:d4.netconvert.net]peverify ConvertIt.exe

Microsoft (R) .NET Framework PE Verifier  Version 1.0.3705.0
Copyright (C) Microsoft Corporation 1998-2001. All rights reserved.

All Classes and Methods in ConvertIt.exe Verified

You can use Microsoft IL Disassembler (ildasm) to examine the executable.

ILDasm on main app
ILDasm running on ConvertIt.exe

You can examine the .NET assembler code for any module.


.NET assembler code for function NthDegree

Delphi for .NET code also works with Lutz Roeder''''s excellent utility, Reflector. (This link contains some other great .NET utilities as well.)


ConvertIt examined in Reflector

The .NET compiler

The Delphi for .NET compiler is more than just a port of the existing Delphi compiler. There is a new code generator, a new linker, significant new syntax, and a new runtime library. Of course, it is also very important to maintain language compatibility, so you will see some familiar old friends in Delphi for .NET as well:

  • Strings & Arrays
  • Records
  • Classes
  • Interfaces
  • Properties & Events
  • Sets
  • Text files
  • Local Procedures
  • Variants
  • Components
  • Streams
  • New, Dispose
  • Readln, Writeln
  • Format
  • Component Streaming
  • Random

In order to fully embrace the CLR and make Delphi a first class citizen in the new world of managed code, some language features must be deprecated, and others are the subject of ongoing research. Though many of these details are still being researched and implemented, it is hoped that the following information will be useful for understanding the new language features of Delphi for .NET.

Unsafe code warnings in Delphi

Starting with Delphi 7, the compiler includes three new warnings that can help you locate code that is non-portable (i.e. it uses a deprecated language feature or type), or unsafe in the .NET Framework. In the .NET Framework, "unsafe" simply means that the code cannot be verified by the static analysis performed by the CLR when the code is loaded. The compiler can warn about the usage of unsafe types, unsafe code, and unsafe casts.

Unsafe types

  • PChar, PWideChar, and PAnsiChar
  • Untyped pointers
  • Untyped var and out parameters
  • File of <type>
  • Real48
  • Variant records (records containing overlapping fields)

    Unsafe code

  • Absolute variables
  • Addr(), Ptr(), Hi(), Lo(), Swap() standard procedures
  • BlockRead(), and BlockWrite()
  • Fail()
  • GetMem(), FreeMem(), ReallocMem()
  • inline assembler
  • the @ operator

    Unsafe casts

  • Casting an object instance to a type that is not an ancestor or descendent of the instance type
  • Casting a record type to anything else

    These new warnings are disabled by default. They can be enabled with the IDE Project Options dialog box, or with the compiler directive:

    {$WARN UNSAFE_CODE ON}

    They can also be enabled with the -W command line switch:

    dcc32 -W+UNSAFE_CODE

    Note there is no space before or after the ''''+'''' character on the command line switch.

    Note: These new warnings are in the Delphi 7 (and beyond) compiler for Win32 (dcc32). They are not in the Delphi for .NET Preview compiler (dccil).

    Deprecated Language Features

    The dccil compiler will also deprecate some existing language features, listed in the following table.

  • Keyword/Language Feature Notes
    教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · C语言系列  · VB.NET程序
    · JAVA开发  · Delphi程序
    · 脚本语言
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台