* RPC: How best to pass back an array?
@ 1993-09-22 17:48 Brad Daniels
0 siblings, 0 replies; only message in thread
From: Brad Daniels @ 1993-09-22 17:48 UTC (permalink / raw)
Apologies if this is a duplicate... My other news machine is misbehaving...
We want to send an array of names to a remote server and get back an
array of values and an array of status. Each value is of a discriminated
union type, and we want a conformant array of them. We can't seem to declare
an [out] parameter of the conformant type, though. E.g., we want to say
something like:
typedef enum {
INT_TYPE, FLOAT_TYPE, DOUBLE_TYPE
} valType;
typedef struct {
union switch (valType t) {
case INT_TYPE: int i;
case FLOAT_TYPE: float f;
case DOUBLE_TYPE: double d;
} valUnion;
} value;
typedef struct {
int count;
[size_is(count)] value vals[];
} valList;
[idempotent] void getValues([out] valList *vals);
... But we get errors. Do we need to do something like:
[idempotent] void getValues([in] int count,
[out,length_is(count)] value vals[]);
In either case, how are we actually supposed to handle memory allocation?
I think we're supposed to just allocate the memory at the client end,
and pass it in to be filled up by the stub. On the server end, we're
expecting the server stub to have allocated appropriate memory. Is this
the right way to handle the memory part? There weren't any examples we
could find in the docs to show how we should be doing this, and the
descriptions are a wee bit confusing.
Examples or explanations much appreciated.
Thanks,
- Brad
--
Brad Daniels | "Let others praise ancient times.
daniels@neosoft.com | I am glad I was born in these."
I don't work for NeoSoft, and | - Ovid (43 B.C. - 17 A.D)
don't speak for my employer. |
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1993-09-22 17:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-09-22 17:48 RPC: How best to pass back an array? Brad Daniels
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox