Using Assemblies in Delphi

Using assemblies similar to the ones just shown is a straightforward process. The first step is to add a reference to the assembly in the project by selecting Project, New Reference from the main menu or right-clicking in the Project Manager and selecting Add Reference After the reference is added, the appropriate namespaces can be added to the uses clause. Listing 6.6 shows a sample project unit that uses both the package and library assemblies created previously. Code from these assemblies is referenced on lines 13 and 14 of the listing.

LISTING 6.6 Using Assemblies in Delphi

1: program TestApp; 2:

5: {%DelphiDotNetAssemblyCompiler 'D8DG.TestPkg.dll'}

6: {%DelphiDotNetAssemblyCompiler 'D8DG.TestLib.dll'} 7:

8: uses

9: D8DG.PkgUnit,

10: D8DG.LibU;

12: begin

13: D8DG.LibU.Unit.BlahBlah;

14: D8DG.PkgUnit.TBlandClass.Create;

. Find the code on the CD: \Code\Chapter 06.

Was this article helpful?

0 0
Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook

Post a comment