Subject: | |
From: | |
Reply To: | |
Date: | Mon, 17 May 1999 21:55:55 GMT |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Greg Fudala ([log in to unmask]) wrote:
: I can't get this to work. This pascal function (in a separate object file)
: returns a pascal packed array [1..8].
: I'd like to have a C program call it and get the result. It always returns
: NULL. According to "HP C Programmer's Guide",
: I am supposed to declare the return result as the struct "pac8" shown
: below.
: Any idea what to do? Thanks very much.
Does the Programmer's Guide say that the C program should declare
struct pac8 with a 9-byte char array? That doesn't sound right,
and I couldn't find that in the manual, but I may be looking at
a different edition of the manual.
Anyway, the caller is expecting to receive a 9-byte result, but
the callee is returning an 8-byte value, and different mechanisms
are used for function returns when the value is more than 8 bytes,
versus less than 9 bytes. If the Pascal function is really going
to return a packed array [1..8] of char, then change the C caller
to expect an 8-byte structure.
One other change you should make is to the conversion specification
in the call to printf(), so that it won't try to print more than
8 characters. I would use
printf("myvar='%.8s'\n", myvar.p);
Walter Murray
Hewlett-Packard
C/iX project
|
|
|