Sun Microsystems SunSoft Pascal 4.0 User Manual page 169

Hewlett-packard user guide printer printer
Table of Contents

Advertisement

The Pascal procedure,
DaysOfWeek.p
The C++ main program,
DaysOfWeekMain.cc
Although it does not apply to this example, arrays of aggregates in Pascal
have, by default, a size that is a multiple of four bytes. When you use the
-calign option to compile Pascal code, that difference from C++ is
eliminated.
The following example illustrates this point. The string 'Sunday' only gets
through to the C++ main program when you compile the Pascal routine using
the -calign option.
type
TDay
= array [0..8] of char;
TWeek = array [0..6] of TDay;
TYear = array [0..51] of TWeek;
procedure DaysOfWeek (
var Y: TYear
);
begin
Y[1][1] := 'Sunday';
end;
#include <stdio.h>
extern "C" void DaysOfWeek (
char [52][7][9]);
int main(void)
{
char Year [52][7][9];
DaysOfWeek (Year);
printf (" Day = '%s' \n", Year[1][1]);
}
The C++–Pascal Interface
7
145

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the SunSoft Pascal 4.0 and is the answer not in the manual?

Questions and answers

Table of Contents