Sign in Join
Wiki copytemporary

Public

Deutsch · English

Back to Reserved words.

The modifier public:

As long as the subroutine has not been declared in the interface section of the unit, it is not visible to other units.
However, it will be possible to access the function subTest at the assembly-language level, by using its mangled name.

pascal
function subTest : string; Public;
  begin
    subTest := 'abc';
  end;

In the old syntax, the modifier Public was surrounded by square brackets: [Public], but the upcoming atrributes syntax uses square brackets as well, so better not to use them for this modifier.\

The public modifier can also be followed by a name directive to specify the assembler name, as follows:

pascal
function subTest : string; Public name 'subtest';
  begin
    subTest := 'abc';
  end;

The assembler symbol as specified by the ’public name’ directive will be ’subtest’, in all lowercase letters.


From the Free Pascal wiki, page "Public", as it stood on 2022-08-06 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 2, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.