next up previous contents index
Next: cdecl Up: Modifiers Previous: Modifiers

Public

The Public keyword is used to declare a function globally in a unit. This is useful if you don't want a function to be accessible from the unit file, but you do want the function to be accessible from the object file.

as an example:

Unit someunit;

interface

Function First : Real;

Implementation

Function First : Real;
begin
  First:=0;
end;

Function Second : Real; [Public];

begin
  Second:=1;
end;

end.

If another program or unit uses this unit, it will not be able to use the function Second, since it isn't declared in the interface part. However, it will be possible to access the function Second at the assembly-language level, by using it's mangled name (Programmer's guide\).



Michael Van Canneyt
Thu Sep 10 14:02:43 CEST 1998