Sign in Join
Wiki copytemporary

Public: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Public

OldNewLine
1+Back to [[Reserved words]].
2+
3+The modifier **public**:
4+
5+- is part of the programming of subroutines;
6+- makes a subroutine public within the unit;
7+- makes sense if the subroutine is not used outside the unit.
8+
9+As long as the subroutine has not been declared in the interface section of the unit, it is not visible to other units.\
10+However, it will be possible to access the function subTest at the assembly-language level, by using its mangled name.
11+
12+``` pascal
13+function subTest : string; Public;
14+ begin
15+ subTest := 'abc';
16+ end;
17+```
18+
19+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.\
20+\
21+The public modifier can also be followed by a name directive to specify the assembler name, as follows:
22+
23+``` pascal
24+function subTest : string; Public name 'subtest';
25+ begin
26+ subTest := 'abc';
27+ end;
28+```
29+
30+The assembler symbol as specified by the ’public name’ directive will be ’subtest’, in all lowercase letters.
31+
32+---
33+*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](/wiki-contact).*

Back to history