|
The INIT: keyword allows initialization to be inserted into the XSUB before the compiler
generates the call to the C function. Unlike the CODE: keyword above, this keyword does not
affect the way the compiler handles RETVAL.
bool_t
rpcb_gettime(host,timep)
char *host
time_t &timep
INIT:
printf("# Host is %s\n", host );
OUTPUT:
timep
|
|
Another use for the INIT: section is to check for preconditions before making a call to the
C function:
long long
lldiv(a,b)
long long a
long long b
INIT:
if (a == 0 && b == 0)
XSRETURN_UNDEF;
if (b == 0)
croak("lldiv: cannot divide by 0");
|
|
|
|