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 4320736
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:39:57+00:00 2026-05-21T08:39:57+00:00

I have a library of functions contained in a delphi unit which we shall

  • 0

I have a library of functions contained in a delphi unit which we shall call UtilitiesU. Some of these functions are just helper functions that are only used inside UtilitiesU. I would like to limit the scope of these functions to UtilitiesU. These are the methods that I know of for doing this:

  1. Remove the declaration from the interface and move the function before its dependents in the implementation – messy, counter-intuitive order of function definitions, not always possible if there is e.g. mutual dependency
  2. Put all the functions into a static class (ala Java) and make them public or private as appropriate – too much boilerplate, convoluted
  3. Declare the helper functions local to the functions in which they are used – same problems as point 1

Ideally, I would like to do it the C/C++ way – that is, declare them as static in the implementation section. Is this possible? Is there a better way?

  • 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. Editorial Team
    Editorial Team
    2026-05-21T08:39:58+00:00Added an answer on May 21, 2026 at 8:39 am

    I would do:

    Remove the declaration from the
    interface and move the function before
    its dependents in the implementation –
    messy, counter-intuitive order of
    function definitions, not always
    possible if there is e.g. mutual
    dependency

    Btw, theres not way of declaring a static class in delphi as you do in other languages. Only var and methods can be static, not the entire class.

    There are other 3 ways

    1 – You can create a class an put all the helper code on it on its private section (maybe statics methods) and use it inside the UtilitiesU unit. Bu I would not go for it, the 1 method you wrote is the best, I think.

    2 – You can separe all your helper code in another unit, lest call it UtilitiesHelper.

    3 – You can mix 1 and 2, but using protected methods. Then you can easily hack the helper class in your UtilitiesU unit. Example:

    In the UtilitiesHelper unit

    TUtilitiesHelper = class
    protected
       //all your methods here
    end;
    

    In the UtilitiesU unit

    TUtilitiesHelperHack = class(TUtilitiesHelper)
    end;
    

    With that you can access protected methods. But I dont recommend it also.

    EDIT

    As Ken said, you can use:

    implementation
    
    procedure ShowMe;forward;
    

    I just tested this myself and it worked. (thats new to me also, thanks Ken).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to import library which is called functions.sage . How can I do
Basically I need some sort of library/set of functions that will allow me to
Of course most languages have library functions for this, but suppose I want to
I have a C++ library and a C++ application trying to use functions and
Many of the standard c library (fwrite, memset, malloc) functions have direct equivalents in
I have a failure in some inner library function in Octave. I want to
I have got a C function in a static library, let's call it A,
I have been trying to call the NewPixelRegionIterator function in ImageMagick's library from C#
Say I had a library called libfoo which contained a class, a few static
I have implemented some utility classes in Flex that I want to use in

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.