Sign in Join
Wiki copytemporary

Public: what changed

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

OldNewLine
11Back to [[Reserved words]].
22
33The modifier **public**:
44
55- is part of the programming of subroutines;
66- makes a subroutine public within the unit;
77- makes sense if the subroutine is not used outside the unit.
88
99As long as the subroutine has not been declared in the interface section of the unit, it is not visible to other units.\
1010However, it will be possible to access the function subTest at the assembly-language level, by using its mangled name.
1111
1212``` pascal
1313function subTest : string; Public;
1414 begin
1515 subTest := 'abc';
1616 end;
1717```
1818
1919In 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-\
20+
2121The public modifier can also be followed by a name directive to specify the assembler name, as follows:
2222
2323``` pascal
2424function subTest : string; Public name 'subtest';
2525 begin
2626 subTest := 'abc';
2727 end;
2828```
2929
3030The assembler symbol as specified by the ’public name’ directive will be ’subtest’, in all lowercase letters.
3131
3232---
3333*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