summaryrefslogtreecommitdiff
path: root/pod/perlxs.pod
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>2002-03-03 21:25:52 -0500
committerAbhijit Menon-Sen <ams@wiw.org>2002-03-04 08:43:37 +0000
commit08ff138dc0c1cdf425c051c295eab8d1f59c736a (patch)
tree18e6b15c4078e5ebe4f82f1bd6c605032c8ecf3f /pod/perlxs.pod
parent0d3b7757875e39a336d967574233c80ebdc2f8b6 (diff)
downloadperl-08ff138dc0c1cdf425c051c295eab8d1f59c736a.tar.gz
xsubpp
Message-Id: <20020304022552.A14106@math.ohio-state.edu> p4raw-link: @14577 on //depot/perl: 0ad5258ff3f3328f321188cbb4fcd6a74b365431 p4raw-id: //depot/perl@14986
Diffstat (limited to 'pod/perlxs.pod')
-rw-r--r--pod/perlxs.pod25
1 files changed, 25 insertions, 0 deletions
diff --git a/pod/perlxs.pod b/pod/perlxs.pod
index c9f7cc8549..78e3e7c97c 100644
--- a/pod/perlxs.pod
+++ b/pod/perlxs.pod
@@ -839,6 +839,31 @@ However, the generated Perl function is called in very C-ish style:
my ($day, $month);
day_month($day, time, $month);
+=head2 The C<length(NAME)> Keyword
+
+If one of the input arguments to the C function is the length of a string
+argument C<NAME>, one can substitute the name of the length-argument by
+C<length(NAME)> in the XSUB declaration. This argument must be omited when
+the generated Perl function is called. E.g.,
+
+ void
+ dump_chars(char *s, short l)
+ {
+ short n = 0;
+ while (n < l) {
+ printf("s[%d] = \"\\%#03o\"\n", n, (int)s[n]);
+ n++;
+ }
+ }
+
+ MODULE = x PACKAGE = x
+
+ void dump_chars(char *s, short length(s))
+
+should be called as C<dump_chars($string)>.
+
+This directive is supported with ANSI-type function declarations only.
+
=head2 Variable-length Parameter Lists
XSUBs can have variable-length parameter lists by specifying an ellipsis