Welcome zhang jinyu
www.borland.com
AppServer
C++
CORBA
Delphi & Kylix
InterBase
Java
Linux
TeamSource DSP
Borland Developer Network Home >Delphi & Kylix> Platforms
Delphi for .NET compiler preview - by John Kaster
Abstract:A first look at the Delphi for .NET compiler features and Delphi''''s new language syntax
by John Kaster and Danny Thorpe
At BorCon 2002, Borland started providing more technical details on our support under development for the .NET platform. This article introduces some of the planned enhancements to the Delphi language and introduces the prototype "Delphi for .NET" compiler. Unless otherwise indicated, the language features discussed here will first be seen in the Delphi for .NET compiler. Furthermore, all of the features discussed in this article may not be introduced in the preview release. When possible, features already implemented in the compiler will be listed, but since the compiler is in beta right now, not much emphasis will be placed on distinguishing what''''s currently implemented and what''''s not.
For a good, brief overview of .NET and an introduction to some of the terms mentioned in this article, see http://arstechnica.com/paedia/n/net/net-1.html.
DCCIL
The Delphi for .NET compiler produces Common Intermediate Language (CIL) applications. These applications can run anywhere the .NET run-time is available as fully managed applications. This means that Delphi applications can now move beyond their traditional Windows/Intel platform to any other platform that has a .NET runtime, such as the .NET compact framework available for tablet PCs, phones, and PDAs.
The Delphi command line compiler for IL is dccil.exe . Here''''s what currently shows up when you run it without any parameters. (This output is guaranteed to change before we release the Delphi for .NET preview with Delphi 7.)
Borland Delphi Version 16.0
Copyright (c) 1983,2002 Borland Software Corporation
Confidential pre-release version built Aug 2 2002 17:29:33
Syntax: dccil [options] filename [options]
-A<unit>=<alias> = Set unit alias -LU<package> = Use package
-B = Build all units -M = Make modified units
-CC = Console target -N<path> = DCU output directory
-CG = GUI target -O<paths> = Object directories
-D<syms> = Define conditionals -P = look for 8.3 file names also
-E<path> = EXE output directory -Q = Quiet compile
-F<offset> = Find error -R<paths> = Resource directories
-GD = Detailed map file -U<paths> = Unit directories
-GP = Map file with publics -V = Debug information in EXE
-GS = Map file with segments -VR = Generate remote debug (RSM)
-H = Output hint messages -W = Output warning messages
-I<paths> = Include directories -Z = Output ''''never build'''' DCPs
-J = Generate .obj file -$<dir> = Compiler directive
-JP = Generate C++ .obj file --help = Show this help screen
-K<addr> = Set image base addr --version = Show name and version
Compiler switches: -$<letter><state> (defaults are shown below)
A8 Aligned record fields P+ Open string params
B- Full boolean Evaluation Q- Integer overflow checking
C+ Evaluate assertions at runtime R- Range checking
D+ Debug information T- Typed @ operator
G+ Use imported data references U- Pentium(tm)-safe divide
H+ Use long strings by default V+ Strict var-strings
I+ I/O checking W- Generate stack frames
J- Writeable structured consts X+ Extended syntax
L+ Local debug symbols Y+ Symbol reference info
M- Runtime type info Z1 Minimum size of enum types
O+ Optimization
product version: VER160
debug level: 2
In an effort to maintain the trend of asking about pronunciations ("Is it ''''delf-ee'''' or ''''delf-eye''''?"), I feel obligated to mention that the R&D team pronounces the compiler as "diesel."
A Delphi for .NET GUI application
As with Kylix, a basic step in our .NET support was getting a compiler that actually produces the appropriate "machine code" executable. In this case, that machine is .NET. A form designer is not currently available for Delphi for .NET, so you will notice that the following code actually initializes the menu items, button, listbox, and up/down control.
program ConvertIt;
uses
System.Drawing,
Borland.Delphi.SysUtils, Borland.Delphi.Conversions, Borland.Vcl.Controls;
type
TForm1 = class(TForm)
private
DoitButton: TButton;
CelsiusEdit: TSpinEdit;
ResultList: TListBox;
MainMenu: TMainMenu;
FileItem: TMenuItem;
ExitItem: TMenuItem;
HelpItem: TMenuItem;
AboutItem: TMenuItem;
procedure DoitButtonClick(Sender: TObject; Args: TEventArgs);
procedure ExitItemClick(Sender: TObject; Args: TEventArgs);
procedure AboutItemClick(Sender: TObject; Args: TEventArgs);
protected
function DecimalToFloat(const AValue: Decimal): Double;
function FloatToDecimal(const AValue: Double): Decimal;
procedure ReadState;
public
constructor Create;
procedure Convert;
end;
var
Form1: TForm1;
function TForm1.DecimalToFloat(const AValue: Decimal): Double;
begin
Result := System.Convert.ToDouble(AValue);
end;
function TForm1.FloatToDecimal(const AValue: Double): Decimal;
begin
Result := System.Convert.ToDecimal(AValue);
end;
procedure TForm1.Convert;
var
LCelsius: Double;
function NthDegree(const Scale: string; const Temperature: double): string;
begin
Result := Format(''''%s = %8.2f'''', [Scale, Temperature]);
end;
begin
LCelsius := DecimalToFloat(CelsiusEdit.Value);
with ResultList.Items do
begin
Clear;
Add(NthDegree(''''Celsius'''', LCelsius));
Add(NthDegree(''''Fahrenheit'''', CelsiusToFahrenheit(LCelsius)));
Add(NthDegree(''''Kelvin'''', CelsiusToKelvin(LCelsius)));
Add(NthDegree(''''Rankine'''', CelsiusToRankine(LCelsius)));
Add(NthDegree(''''Reaumur'''', CelsiusToReaumur(LCelsius)));
end;
end;
procedure TForm1.DoitButtonClick(Sender: TObject; Args: TEventArgs);
begin
Convert;
end;
procedure TForm1.ExitItemClick(Sender: TObject; Args: TEventArgs);
begin
Close;
end;
procedure TForm1.AboutItemClick(Sender: TObject; Args: TEventArgs);
begin
TMessageBox.Show(Text + '''' whatever'''');
end;
constructor TForm1.Create;
begin
inherited Create;
ReadState;
end;
procedure TForm1.ReadState;
begin
MainMenu := TMainMenu.Create;
FileItem := TMenuItem.Create;
ExitItem := TMenuItem.Create;
HelpIt[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文件的代…
|