Example

All the preceding principles can be seen at work in the following example. Suppose a function is declared in AIL as follows:

some_stub(*, in char buf[size:1000], in int size,
             out int n_done, out int status);
In C it might be called by the following code (including declarations, for clarity, but not initializations):
int err, n_done, status;
capability cap;
char buf[500];
...
err = some_stub(&cap, buf, sizeof buf, &n_done, &status);
if (err != 0) return err;
printf("%d done; status = %d\n", n_done, status);
Equivalent code in Python might be the following:
cap = ...
buf = ...
n_done, status = cap.some_stub(buf)
print n_done, 'done;', 'status =', status
No explicit error check is required in Python: if the RPC fails, an exception is raised so the print statement is never reached.