3.3 Compiling a unit

Compiling a unit is not essentially dierent from compiling a program. The dierence is mainly that the linker isn't called in this case.

To compile a unit in the le foo.pp, just type :

  fpc  foo

Recall the remark about le extensions in the previous section.

When all went well, you will be left with 2 (two) unit les:

  1. foo.ppu This is the le describing the unit you just compiled.
  2. foo.o This le contains the actual code of the unit. This le will eventually end up in the executables.

Both les are needed if you plan to use the unit for some programs. So don't delete them. If you want to distribute the unit, you must provide both the .ppu and .o le. One is useless without the other.