Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 106341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:34:53+00:00 2026-05-11T01:34:53+00:00

I have a console application written in Delphi. I saw that I can have

  • 0

I have a console application written in Delphi. I saw that I can have global variables by assigning them to unit scopes, but in a console application I don’t use units (from what I’ve understood it’s forms-only).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:34:54+00:00Added an answer on May 11, 2026 at 1:34 am

    Nope, a unit is not equivalent to a form.

    A unit is a module which contains part of your program. Each form is a separate unit but a unit does not have to contain a form.

    Each unit has an interface section and a implementation section. The declarations in the interface section are visible to all units that use the unit:

    unit A;  interface    type     TMyClass = class     end;   implementation  end.   unit B;  interface  uses   A;  // I can now see and use TMyClass. 

    You can declare global variables by declaring them in a unit:

    unit A;  interface    var     GVar1 : Integer;  implementation    var      GVar2 : Integer;  end. 

    GVar1 is visible and can be modified by all units using unit A. GVar2 is only visisble by the code of unit A because it is defined in the implementation section.

    I strongly advice against using globals in the interface section because you have no control over them (because anybody can change them). If you really need a global, you better define it in the implementations section and provide access functions.

    By the way, you can see a unit as a kind of a class (with a single instance). It even has a way to construct and destruct:

    unit A;  interface    type     TMyClass = class     end;   implementation  initialization   // Initialize the unit finalization   // Free resources etc. You can olny have a finalization if you have an initialization. end. 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a console application in Delphi that queries information from several locations.
I have a written a Visual C++ console application (i.e. subsystem:console) that prints useful
I have a console application written in C#/.NET that I want to run from
I have a console application written in Free Pascal, that like most larger applications
I have a console application written in C# that is scheduled to run every
I have written a console application in C# /VS2008. In that I have multiple
I have a console application that will be kicked off with a scheduler. If
I have a console application that require to use some code that need administrator
I have a console application project in C# 2.0 that needs to write something
I have a console application that I would like to run as 'NT AUTHORITY\NetworkService',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.