?
Solved

Delphi isolate functions and procedures to different file

Posted on 2003-03-26
2
Medium Priority
?
172 Views
Last Modified: 2011-09-20
Hi everyone
               i have written a application on delphi The problem is that the number of lines of my code is more than 5300, so i have desided to isolate the main functions to a different file , i know there is a way to do it by creating files and adding it in the uses claws > can u please tell me how to do this , im just new to delphi
0
Comment
Question by:samuel_chinnu123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Expert Comment

by:Motaz
ID: 8215507
in File Menu, Click Add, and Select unit: then you will get an empty unit template:

unit Unit2;

interface

implementation

end.

- Save this unit
- in implementation write all procedures and functions you need
- in Interface section, write all procedure/function headers that you want other units to access it:

unit Test

interface

function Sum(a, b: Integer): Integer;

implementation

function Sum(a, b: Integer): Integer;
begin
  Result:= A + B;
end;

end.

- Alos you can put all global variables and types you want others to see it in Interface section:

interface
type
  TRec = record
    name: string;
    DOB: TDateTime;
   end;
var
  state: Integer;


   
to call that function from other units, go to File/Add Unit and select that unit name

then you can call any procedure and function on that unit the same you do to local function/procedure

Motaz
0
 

Accepted Solution

by:
sammy_chinnu earned 240 total points
ID: 8222317
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month10 days, 16 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question