The C++–Pascal Interface
141
7
Simple Types with the
-xl
Option
With the
-xl
option, the Pascal
real
must be paired with a C++
float
; the
Pascal integer must be paired with a C++
short int
.
The C++ main program,
SamRefMain.cc
#include <stdio.h>
extern "C" void SamRef (
char
&,
char
&,
char
&,
int
&,
short
&,
float
&,
double
&);
int main(void)
{
char
t, f, c;
int
i;
short
s;
float r;
double d;
SamRef (t, f, c, i, s, r, d);
printf ("%08o %08o %c %d %d %3.1f %3.1f \n",
t, f, c, i, s, r, d);
}
The commands to compile and
execute
SamRef.p and
SamRefMain.cc
hostname% pc -c SamRef.p
hostname% CC SimRef.o SamRefMain.cc -lpc
hostname% a.out
00000001 00000000 z 9 9 9.9 9.9
Содержание SunSoft Pascal 4.0
Страница 14: ...xiv Pascal 4 0 User s Guide ...
Страница 16: ...xvi Pascal 4 0 User s Guide ...
Страница 30: ...6 Pascal 4 0 User s Guide 1 ...
Страница 160: ...136 Pascal 4 0 User s Guide 6 ...
Страница 268: ...244 Pascal 4 0 User s Guide 11 ...
Страница 320: ...296 Pascal 4 0 User s Guide B ...
Страница 331: ...Index 307 ...
Страница 333: ......