Using DLLs in Your Delphi Applications

Earlier in this chapter, you learned that there are two ways to load or import DLLs: implicitly and explicitly. Both techniques are illustrated in this section with the DLLs just created.

The first DLL created in this chapter included an interface unit. You'll use this interface unit in the following example to illustrate implicit linking of a DLL. The sample project's main form has a TMaskEdit, TButton, and nine TLabel components.

In this application, the user enters an amount of pennies. Then, when the user clicks the button, the labels will show the breakdown of denominations of change adding up to that amount. This information is obtained from the PenniesLib.dll exported function PenniesToCoins().

Get Borland® Delphi™ 6 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.