6

The -coption produces an unlinked object file. The -calignoption causes pc to use C-like data formats for aggregate objects.

When you compile a Pascal main routine that calls C, you don’t have to use any special options, but the -calignoption is again useful. The C object library, libc, is automatically brought in for every Pascal compilation.

For example:

hostname% cc -c my_c.c

hostname% pc -calign my_c.o my_pascal.p

Compatibility of Types for C and Pascal

Table 6-1 and Table 6-2 list the default sizes and alignments of compatible types for C and Pascal.

Table 6-1C and Pascal Size and Alignment of Compatible Types

Pascal Type

C Type

Size (bytes)

Alignment (bytes)

 

 

 

 

double

double

8

8

 

 

 

 

longreal

double

8

8

 

 

 

 

real

double

8

8

 

 

 

 

 

single

float

 

4

4

 

 

 

 

 

shortreal

float

 

4

4

 

 

 

 

 

integer16

short

int

2

2

 

 

 

 

 

integer32

int

 

4

4

 

 

 

 

 

integer

int

 

4

4

 

 

 

 

 

-128..127

char

 

1

1

 

 

 

 

 

boolean

char

 

1

1

 

 

 

 

 

alfa

char

a[10]

10

1

 

 

 

 

 

char

char

 

1

1

 

 

 

 

 

string

char

a[80]

80

1

 

 

 

 

varying[n] of char

struct {int, char[n]}

-

4

 

 

 

 

record

struct/union

-

Same as element type

 

 

 

 

 

90

Pascal 4.0 User’s Guide