The following works as a program, but not as a unit (used e.g. by an empty program). It gives the following runtime message (DJGPP and Linux):
?GPC runtime error: (gpc-rts) _p_initfdr() has not been called for file (#701)
{$define u} {$IFDEF u} UNIT printer; INTERFACE {$ENDIF}
USES System;
VAR Lst:Text;
{$IFDEF u} IMPLEMENTATION TO BEGIN DO {$ENDIF} BEGIN Assign(Lst,'LPR'); Rewrite(Lst); writeln(Lst,'Test'); Close(Lst) {$IFDEF u} END; {$ENDIF} END.
Apropos: Did anyone write a portable printer unit yet?