|
The C_ARGS: keyword allows creating of XSUBS which have different calling sequence from
Perl than from C, without a need to write CODE: or PPCODE: section. The contents of the C_ARGS:
paragraph is put as the argument to the called C function without any change.
For example, suppose that a C function is declared as
symbolic nth_derivative(int n, symbolic function, int flags);
|
|
and that the default flags are kept in a global C variable default_flags.
Suppose that you want to create an interface which is called as
$second_deriv = $function->nth_derivative(2);
|
|
To do this, declare the XSUB as
symbolic
nth_derivative(function, n)
symbolic function
int n
C_ARGS:
n, function, default_flags
|
|
|
|