Linking to Object Files

To call routines from a separately compiled object file, first link the object file to your application using the $l (or $link) compiler directive. For example,

links BLOCK.OBJ into the program or unit in which it occurs. Next, declare the functions and procedures that you want to call:

procedure MoveWord(var Source, Dest; Count: Integer); external; procedure FillWord(var Dest; Data: Integer; Count: Integer); external;

Now you can call the MoveWord and FillWord routines from BLOCK.OBJ.

On the Win32 platform, declarations like the ones above are frequently used to access external routines written in assembly language. You can also place assembly-language routines directly in your Delphi source code.

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