Delphi2005 learning notes 4 - talk about Namespace and DLL and Package

xiaoxiao2021-03-06  61

I saw an article in BDN today.

Http://bdn.borland.com/Article/0,1410,32765,00.html

The important part is extracted as follows

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 the unit name up to the last dot is used.

• if it is not dotted the default namespace is used.

• if the is no default namespace dam..

• Code Converted from Delphi 8 May Require Some Modifications.

• Always Use Packages Not Libraries to Create Shareable assembly.

• 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

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 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: = ask.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. This explains my original question, in the D2005, a new .Net Dll, Compile, in other compilers (C #), you can use it, but you can't use it in Delphi, although you can solve the problem, it is very inconvenient to add resources, I really don't know how Borland thinks.

转载请注明原文地址:https://www.9cbs.com/read-83904.html

New Post(0)