.NET
  Home arrow .NET arrow Page 4 - The Delphi Language, Part 2
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

The Delphi Language, Part 2
By: Xavier Pacheco
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 15
    2004-07-13

    Table of Contents:
  • The Delphi Language, Part 2
  • Out Parameters, Constant Parameters, and Open Array Parameters
  • Scope and Units and Namespaces
  • The uses Clause and Circular Unit References
  • Object-Oriented Programming
  • Using Delphi Objects
  • Methods
  • Class References and Properties
  • Events
  • Visibility Specifiers, Friend Classes and Class Helpers
  • Nested Types, Operator Overloading and Attributes
  • Interfaces
  • Using Interfaces, SEH
  • Exception Classes

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    The Delphi Language, Part 2 - The uses Clause and Circular Unit References


    (Page 4 of 14 )

    The uses clause is where you list the namespaces that you want to include in a particular program or unit. For example, if you have a program called FooProg that uses functions and types in two namespaces, UnitA and UnitB, the proper uses declaration is as follows:

    program FooProg;

    uses UnitA, UnitB;

    Units can have two uses clauses: one in the interface section and one in the implementation section.

    Here's code for a sample unit:

    unit FooBar;

    interface

    uses BarFoo;

      { public declarations here }

    implementation

    uses BarFly; 

    { private declarations here }
    {definition of routines declared in interface section}

    initialization
      { unit initialization here }
    finalization
      { unit clean-up here }
    end.


    Note - The uses clause might have the fully qualified namespaces, or Delphi permits using just the innermost namespace name in the uses clause for backward compatibility (for example, Controls) using the namespace prefixes control of the Tools, Options, Delphi Options, Library dialog.


    Circular Unit References

    Occasionally, you'll have a situation in which UnitA uses UnitB and UnitB uses UnitA. This is called a circular unit reference. The occurrence of a circular unit reference is often an indication of a design flaw in your application; you should avoid structuring your program with a circular reference. The optimal solution is often to move a piece of data that both UnitA and UnitB need to use out to a third unit. However, as with most things, sometimes you just can't avoid the circular unit reference. Note that circular references in both the interface or implementation section are illegal. Therefore, in such a case, move one of the uses clauses to the implementation part of your unit and leave the other one in the interface part. This usually solves the problem.

    Packages and Assemblies

    Delphi packages enable you to place portions of your application into separate modules, which can be shared across multiple applications as .NET assemblies.

    Packages and Assemblies are described in detail in Chapter 6, "Assemblies: Libraries and Packages."

    This chapter is from Delphi for .NET Developer's Guide, by Xavier Pacheco (Sams, 2004, ISBN: 0-672-32443-1). Check it out at your favorite bookstore today.

    Buy this book now.

    More .NET Articles
    More By Xavier Pacheco


     

    .NET ARTICLES

    - Building Applications with Windows Workflow ...
    - Building the Data and Business Layers Using ...
    - The Transformed XML Explorer in MFC
    - List Control and Property Grid with the MFC ...
    - Font, Shell and Masked Edit Controls for MFC
    - Color, Link and Image Editor Controls for M...
    - New Controls for MFC
    - The Windows Ribbon Framework
    - Markup Language for the Ribbon Framework
    - Visually Upgrade Your MFC Project
    - New Features for the Statusbar in MFC
    - Working with the Statusbar in MFC
    - Iron Speed Design v60 Review
    - Binary and XML Serialization
    - Using CrystalReportViewer to Display Crystal...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek