HP SunSoft Pascal 4.0 Bedienungsanleitung Seite 151

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 333
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 150
The C–Pascal Interface 127
6
The -calign option is not needed in the previous example, but may be
necessary if the record contains aggregates.
Non-Pascal Procedures
When you use the -xl option in compiling Pascal code, you can use the
nonpascal keyword to declare that an external procedure is written in
another language. This keyword generally causes everything to be passed by
reference.
The Pascal main program,
VarRecMain.p
program VarRecMain;
type
vr = record
case tag: char of
'a': (ch1, ch2: char);
'b': (flag: boolean);
'K': (ALIGN: integer)
end;
var
x: vr;
procedure VarRec(var d: vr); external c;
begin
x.tag := 'a';
x.ch1 := 'a';
x.ch2 := 'b';
VarRec(x);
writeln(x.ch2)
end. { VarRecMain }
The commands to compile and
execute VarRec.c and
VarRecMain.p
hostname% cc -c VarRec.c
hostname% pc -calign VarRec.o VarRecMain.p
hostname% a.out
Z
Seitenansicht 150
1 2 ... 146 147 148 149 150 151 152 153 154 155 156 ... 332 333

Kommentare zu diesen Handbüchern

Keine Kommentare