网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > Delphi
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
本月文章推荐
.TFontNameComboBox及TFontSizeCo.
.使DevExpress日期控件正确显示.
.谈用Delphi程序获取拨号连接的动.
.与文件相关Api函数列表.
.Delphi第三方控件全面评比介绍(.
.捆绑执行文件新思维(第二版).
.防止程序多次运行.
.注册表数据库Registry.
.让你的DBGrid竖着站(1).
.通过原代码学习TComponent类的机.
.我的共享软件防破解的实用着法.
.利用未公开函数实现Shell操作监视.
.控件style你知我知.
.[Delphi版]罗技无限灵貂,驱动程序.
.窗体的建立时机及缓冲的思想在in.
.控件移动类的实现之一.
.开发Web应用程序中Cookie使用的问.
.COM程序编写入门(全文-1).
.Command模式.
.fileStream.

Delphi2005学习笔记4——再谈NameSpace和Dll以及Package

发表日期:2006-2-4


今天在BDN中看到一篇文章
http://bdn.borland.com/article/0,1410,32765,00.html

重要的部分摘抄如下

Executive Summary

          Namespaces do not affect Delphi for Win32.

          Namespaces are produced based on the unit name as follows:

          If a unit name is dotted then the unit name up to the last dot is used.

          If it is not dotted then the default namespace is used.

          If there is no default namespace then the unit name is used.

          Code converted from Delphi 8 may require some modifications.

          Always use Packages not Libraries to create shareable assemblies.

          Delphi will always refer to types by their full unit name.

          Other languages will need to refer to types using their namespace.

          ASP.NET declarations, configuration files and .NET reflection always refer to types by their namespace.

          If multiple units emit a public type with the same name into the same namespace, the assembly may be unusable

1)     Always Use Packages

Borland has always recommended not using library projects to create assemblies. In Delphi 2005, the compiler is stricter and will no longer allow you to compile an application referencing a Delphi ‘library’.
Always use a package project to create .NET assemblies.

However, as with anything, there are exceptions to the rule and there are several situations where you need to use the namespace even though you are coding in Delphi.

 

One example is when you are using tags in ASPX, ASCX or ASMX files. If you create a web page called TWebForm in the file Application.­Pages.­WebForm1.­­pas then the page tag would be:

 

<%@Page Language="c#" Codebehind="WebForm1.pas" Inherits="Application.Pages.TWebForm1"%>

 

Another is when passing type information to .NET in the form of strings, especially when using reflection based APIs and configuration files:

 

var c:TypeConverter;

c:=Assembly.CreateInstance('Sample.Controls.TConverter');

 

This slight difference commonly trips people up and is something you need to be careful of, especially when porting code from Delphi 8 or converting code from other languages.

这就解释了我原来的疑问,在D2005中,新建一个.Net Dll,编译,在别的编译器中(C#),可以使用,但是在Delphi中自己却不能用,虽然用薄可以解决问题,但是包中添加资源很不方便,真是不知道Borland是怎么想的。


上一篇:Delphi帮助里的虚拟键值表 人气:5554
下一篇:网站上传漏洞利用程序 人气:4677
浏览全部Delphi的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐