Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / man / man1 / h2xs.1
CommitLineData
920dae64
AT
1.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sh \" Subsection heading
6.br
7.if t .Sp
8.ne 5
9.PP
10\fB\\$1\fR
11.PP
12..
13.de Sp \" Vertical space (when we can't use .PP)
14.if t .sp .5v
15.if n .sp
16..
17.de Vb \" Begin verbatim text
18.ft CW
19.nf
20.ne \\$1
21..
22.de Ve \" End verbatim text
23.ft R
24.fi
25..
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28.\" double quote, and \*(R" will give a right double quote. | will give a
29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31.\" expand to `' in nroff, nothing in troff, for use with C<>.
32.tr \(*W-|\(bv\*(Tr
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34.ie n \{\
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
43'br\}
44.el\{\
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
49'br\}
50.\"
51.\" If the F register is turned on, we'll generate index entries on stderr for
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53.\" entries marked with X<> in POD. Of course, you'll have to process the
54.\" output yourself in some meaningful fashion.
55.if \nF \{\
56. de IX
57. tm Index:\\$1\t\\n%\t"\\$2"
58..
59. nr % 0
60. rr F
61.\}
62.\"
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64.\" way too many mistakes in technical documents.
65.hy 0
66.if n .na
67.\"
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69.\" Fear. Run. Save yourself. No user-serviceable parts.
70. \" fudge factors for nroff and troff
71.if n \{\
72. ds #H 0
73. ds #V .8m
74. ds #F .3m
75. ds #[ \f1
76. ds #] \fP
77.\}
78.if t \{\
79. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80. ds #V .6m
81. ds #F 0
82. ds #[ \&
83. ds #] \&
84.\}
85. \" simple accents for nroff and troff
86.if n \{\
87. ds ' \&
88. ds ` \&
89. ds ^ \&
90. ds , \&
91. ds ~ ~
92. ds /
93.\}
94.if t \{\
95. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101.\}
102. \" troff and (daisy-wheel) nroff accents
103.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110.ds ae a\h'-(\w'a'u*4/10)'e
111.ds Ae A\h'-(\w'A'u*4/10)'E
112. \" corrections for vroff
113.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115. \" for low resolution devices (crt and lpr)
116.if \n(.H>23 .if \n(.V>19 \
117\{\
118. ds : e
119. ds 8 ss
120. ds o a
121. ds d- d\h'-1'\(ga
122. ds D- D\h'-1'\(hy
123. ds th \o'bp'
124. ds Th \o'LP'
125. ds ae ae
126. ds Ae AE
127.\}
128.rm #[ #] #H #V #F C
129.\" ========================================================================
130.\"
131.IX Title "H2XS 1"
132.TH H2XS 1 "2007-06-19" "perl v5.8.8" "Perl Programmers Reference Guide"
133.SH "NAME"
134h2xs \- convert .h C header files to Perl extensions
135.SH "SYNOPSIS"
136.IX Header "SYNOPSIS"
137\&\fBh2xs\fR [\fB\s-1OPTIONS\s0\fR ...] [headerfile ... [extra_libraries]]
138.PP
139\&\fBh2xs\fR \fB\-h\fR|\fB\-?\fR|\fB\-\-help\fR
140.SH "DESCRIPTION"
141.IX Header "DESCRIPTION"
142\&\fIh2xs\fR builds a Perl extension from C header files. The extension
143will include functions which can be used to retrieve the value of any
144#define statement which was in the C header files.
145.PP
146The \fImodule_name\fR will be used for the name of the extension. If
147module_name is not supplied then the name of the first header file
148will be used, with the first character capitalized.
149.PP
150If the extension might need extra libraries, they should be included
151here. The extension Makefile.PL will take care of checking whether
152the libraries actually exist and how they should be loaded. The extra
153libraries should be specified in the form \-lm \-lposix, etc, just as on
154the cc command line. By default, the Makefile.PL will search through
155the library path determined by Configure. That path can be augmented
156by including arguments of the form \fB\-L/another/library/path\fR in the
157extra-libraries argument.
158.SH "OPTIONS"
159.IX Header "OPTIONS"
160.IP "\fB\-A\fR, \fB\-\-omit\-autoload\fR" 5
161.IX Item "-A, --omit-autoload"
162Omit all autoload facilities. This is the same as \fB\-c\fR but also
163removes the \f(CW\*(C`use\ AutoLoader\*(C'\fR statement from the .pm file.
164.IP "\fB\-B\fR, \fB\-\-beta\-version\fR" 5
165.IX Item "-B, --beta-version"
166Use an alpha/beta style version number. Causes version number to
167be \*(L"0.00_01\*(R" unless \fB\-v\fR is specified.
168.IP "\fB\-C\fR, \fB\-\-omit\-changes\fR" 5
169.IX Item "-C, --omit-changes"
170Omits creation of the \fIChanges\fR file, and adds a \s-1HISTORY\s0 section to
171the \s-1POD\s0 template.
172.IP "\fB\-F\fR, \fB\-\-cpp\-flags\fR=\fIaddflags\fR" 5
173.IX Item "-F, --cpp-flags=addflags"
174Additional flags to specify to C preprocessor when scanning header for
175function declarations. Writes these options in the generated \fIMakefile.PL\fR
176too.
177.IP "\fB\-M\fR, \fB\-\-func\-mask\fR=\fIregular expression\fR" 5
178.IX Item "-M, --func-mask=regular expression"
179selects functions/macros to process.
180.IP "\fB\-O\fR, \fB\-\-overwrite\-ok\fR" 5
181.IX Item "-O, --overwrite-ok"
182Allows a pre-existing extension directory to be overwritten.
183.IP "\fB\-P\fR, \fB\-\-omit\-pod\fR" 5
184.IX Item "-P, --omit-pod"
185Omit the autogenerated stub \s-1POD\s0 section.
186.IP "\fB\-X\fR, \fB\-\-omit\-XS\fR" 5
187.IX Item "-X, --omit-XS"
188Omit the \s-1XS\s0 portion. Used to generate templates for a module which is not
189XS\-based. \f(CW\*(C`\-c\*(C'\fR and \f(CW\*(C`\-f\*(C'\fR are implicitly enabled.
190.IP "\fB\-a\fR, \fB\-\-gen\-accessors\fR" 5
191.IX Item "-a, --gen-accessors"
192Generate an accessor method for each element of structs and unions. The
193generated methods are named after the element name; will return the current
194value of the element if called without additional arguments; and will set
195the element to the supplied value (and return the new value) if called with
196an additional argument. Embedded structures and unions are returned as a
197pointer rather than the complete structure, to facilitate chained calls.
198.Sp
199These methods all apply to the Ptr type for the structure; additionally
200two methods are constructed for the structure type itself, \f(CW\*(C`_to_ptr\*(C'\fR
201which returns a Ptr type pointing to the same structure, and a \f(CW\*(C`new\*(C'\fR
202method to construct and return a new structure, initialised to zeroes.
203.IP "\fB\-b\fR, \fB\-\-compat\-version\fR=\fIversion\fR" 5
204.IX Item "-b, --compat-version=version"
205Generates a .pm file which is backwards compatible with the specified
206perl version.
207.Sp
208For versions < 5.6.0, the changes are.
209 \- no use of 'our' (uses 'use vars' instead)
210 \- no 'use warnings'
211.Sp
212Specifying a compatibility version higher than the version of perl you
213are using to run h2xs will have no effect. If unspecified h2xs will default
214to compatibility with the version of perl you are using to run h2xs.
215.IP "\fB\-c\fR, \fB\-\-omit\-constant\fR" 5
216.IX Item "-c, --omit-constant"
217Omit \f(CW\*(C`constant()\*(C'\fR from the .xs file and corresponding specialised
218\&\f(CW\*(C`AUTOLOAD\*(C'\fR from the .pm file.
219.IP "\fB\-d\fR, \fB\-\-debugging\fR" 5
220.IX Item "-d, --debugging"
221Turn on debugging messages.
222.IP "\fB\-e\fR, \fB\-\-omit\-enums\fR=[\fIregular expression\fR]" 5
223.IX Item "-e, --omit-enums=[regular expression]"
224If \fIregular expression\fR is not given, skip all constants that are defined in
225a C enumeration. Otherwise skip only those constants that are defined in an
226enum whose name matches \fIregular expression\fR.
227.Sp
228Since \fIregular expression\fR is optional, make sure that this switch is followed
229by at least one other switch if you omit \fIregular expression\fR and have some
230pending arguments such as header-file names. This is ok:
231.Sp
232.Vb 1
233\& h2xs -e -n Module::Foo foo.h
234.Ve
235.Sp
236This is not ok:
237.Sp
238.Vb 1
239\& h2xs -n Module::Foo -e foo.h
240.Ve
241.Sp
242In the latter, foo.h is taken as \fIregular expression\fR.
243.IP "\fB\-f\fR, \fB\-\-force\fR" 5
244.IX Item "-f, --force"
245Allows an extension to be created for a header even if that header is
246not found in standard include directories.
247.IP "\fB\-g\fR, \fB\-\-global\fR" 5
248.IX Item "-g, --global"
249Include code for safely storing static data in the .xs file.
250Extensions that do no make use of static data can ignore this option.
251.IP "\fB\-h\fR, \fB\-?\fR, \fB\-\-help\fR" 5
252.IX Item "-h, -?, --help"
253Print the usage, help and version for this h2xs and exit.
254.IP "\fB\-k\fR, \fB\-\-omit\-const\-func\fR" 5
255.IX Item "-k, --omit-const-func"
256For function arguments declared as \f(CW\*(C`const\*(C'\fR, omit the const attribute in the
257generated \s-1XS\s0 code.
258.IP "\fB\-m\fR, \fB\-\-gen\-tied\-var\fR" 5
259.IX Item "-m, --gen-tied-var"
260\&\fBExperimental\fR: for each variable declared in the header file(s), declare
261a perl variable of the same name magically tied to the C variable.
262.IP "\fB\-n\fR, \fB\-\-name\fR=\fImodule_name\fR" 5
263.IX Item "-n, --name=module_name"
264Specifies a name to be used for the extension, e.g., \-n\ \s-1RPC::DCE\s0
265.IP "\fB\-o\fR, \fB\-\-opaque\-re\fR=\fIregular expression\fR" 5
266.IX Item "-o, --opaque-re=regular expression"
267Use \*(L"opaque\*(R" data type for the C types matched by the regular
268expression, even if these types are \f(CW\*(C`typedef\*(C'\fR\-equivalent to types
269from typemaps. Should not be used without \fB\-x\fR.
270.Sp
271This may be useful since, say, types which are \f(CW\*(C`typedef\*(C'\fR\-equivalent
272to integers may represent OS-related handles, and one may want to work
273with these handles in OO\-way, as in \f(CW\*(C`$handle\->do_something()\*(C'\fR.
274Use \f(CW\*(C`\-o .\*(C'\fR if you want to handle all the \f(CW\*(C`typedef\*(C'\fRed types as opaque
275types.
276.Sp
277The type-to-match is whitewashed (except for commas, which have no
278whitespace before them, and multiple \f(CW\*(C`*\*(C'\fR which have no whitespace
279between them).
280.IP "\fB\-p\fR, \fB\-\-remove\-prefix\fR=\fIprefix\fR" 5
281.IX Item "-p, --remove-prefix=prefix"
282Specify a prefix which should be removed from the Perl function names,
283e.g., \-p\ sec_rgy_ This sets up the \s-1XS\s0 \fB\s-1PREFIX\s0\fR keyword and removes
284the prefix from functions that are autoloaded via the \f(CW\*(C`constant()\*(C'\fR
285mechanism.
286.IP "\fB\-s\fR, \fB\-\-const\-subs\fR=\fIsub1,sub2\fR" 5
287.IX Item "-s, --const-subs=sub1,sub2"
288Create a perl subroutine for the specified macros rather than autoload
289with the \fIconstant()\fR subroutine. These macros are assumed to have a
290return type of \fBchar *\fR, e.g.,
291\&\-s\ sec_rgy_wildcard_name,sec_rgy_wildcard_sid.
292.IP "\fB\-t\fR, \fB\-\-default\-type\fR=\fItype\fR" 5
293.IX Item "-t, --default-type=type"
294Specify the internal type that the \fIconstant()\fR mechanism uses for macros.
295The default is \s-1IV\s0 (signed integer). Currently all macros found during the
296header scanning process will be assumed to have this type. Future versions
297of \f(CW\*(C`h2xs\*(C'\fR may gain the ability to make educated guesses.
298.IP "\fB\-\-use\-new\-tests\fR" 5
299.IX Item "--use-new-tests"
300When \fB\-\-compat\-version\fR (\fB\-b\fR) is present the generated tests will use
301\&\f(CW\*(C`Test::More\*(C'\fR rather than \f(CW\*(C`Test\*(C'\fR which is the default for versions before
3025.7.2 . \f(CW\*(C`Test::More\*(C'\fR will be added to \s-1PREREQ_PM\s0 in the generated
303\&\f(CW\*(C`Makefile.PL\*(C'\fR.
304.IP "\fB\-\-use\-old\-tests\fR" 5
305.IX Item "--use-old-tests"
306Will force the generation of test code that uses the older \f(CW\*(C`Test\*(C'\fR module.
307.IP "\fB\-\-skip\-exporter\fR" 5
308.IX Item "--skip-exporter"
309Do not use \f(CW\*(C`Exporter\*(C'\fR and/or export any symbol.
310.IP "\fB\-\-skip\-ppport\fR" 5
311.IX Item "--skip-ppport"
312Do not use \f(CW\*(C`Devel::PPPort\*(C'\fR: no portability to older version.
313.IP "\fB\-\-skip\-autoloader\fR" 5
314.IX Item "--skip-autoloader"
315Do not use the module \f(CW\*(C`AutoLoader\*(C'\fR; but keep the \fIconstant()\fR function
316and \f(CW\*(C`sub AUTOLOAD\*(C'\fR for constants.
317.IP "\fB\-\-skip\-strict\fR" 5
318.IX Item "--skip-strict"
319Do not use the pragma \f(CW\*(C`strict\*(C'\fR.
320.IP "\fB\-\-skip\-warnings\fR" 5
321.IX Item "--skip-warnings"
322Do not use the pragma \f(CW\*(C`warnings\*(C'\fR.
323.IP "\fB\-v\fR, \fB\-\-version\fR=\fIversion\fR" 5
324.IX Item "-v, --version=version"
325Specify a version number for this extension. This version number is added
326to the templates. The default is 0.01, or 0.00_01 if \f(CW\*(C`\-B\*(C'\fR is specified.
327The version specified should be numeric.
328.IP "\fB\-x\fR, \fB\-\-autogen\-xsubs\fR" 5
329.IX Item "-x, --autogen-xsubs"
330Automatically generate XSUBs basing on function declarations in the
331header file. The package \f(CW\*(C`C::Scan\*(C'\fR should be installed. If this
332option is specified, the name of the header file may look like
333\&\f(CW\*(C`NAME1,NAME2\*(C'\fR. In this case \s-1NAME1\s0 is used instead of the specified
334string, but XSUBs are emitted only for the declarations included from
335file \s-1NAME2\s0.
336.Sp
337Note that some types of arguments/return\-values for functions may
338result in XSUB\-declarations/typemap\-entries which need
339hand\-editing. Such may be objects which cannot be converted from/to a
340pointer (like \f(CW\*(C`long long\*(C'\fR), pointers to functions, or arrays. See
341also the section on "\s-1LIMITATIONS\s0 of \fB\-x\fR".
342.SH "EXAMPLES"
343.IX Header "EXAMPLES"
344.Vb 2
345\& # Default behavior, extension is Rusers
346\& h2xs rpcsvc/rusers
347.Ve
348.PP
349.Vb 2
350\& # Same, but extension is RUSERS
351\& h2xs -n RUSERS rpcsvc/rusers
352.Ve
353.PP
354.Vb 2
355\& # Extension is rpcsvc::rusers. Still finds <rpcsvc/rusers.h>
356\& h2xs rpcsvc::rusers
357.Ve
358.PP
359.Vb 2
360\& # Extension is ONC::RPC. Still finds <rpcsvc/rusers.h>
361\& h2xs -n ONC::RPC rpcsvc/rusers
362.Ve
363.PP
364.Vb 2
365\& # Without constant() or AUTOLOAD
366\& h2xs -c rpcsvc/rusers
367.Ve
368.PP
369.Vb 2
370\& # Creates templates for an extension named RPC
371\& h2xs -cfn RPC
372.Ve
373.PP
374.Vb 2
375\& # Extension is ONC::RPC.
376\& h2xs -cfn ONC::RPC
377.Ve
378.PP
379.Vb 4
380\& # Extension is Lib::Foo which works at least with Perl5.005_03.
381\& # Constants are created for all #defines and enums h2xs can find
382\& # in foo.h.
383\& h2xs -b 5.5.3 -n Lib::Foo foo.h
384.Ve
385.PP
386.Vb 4
387\& # Extension is Lib::Foo which works at least with Perl5.005_03.
388\& # Constants are created for all #defines but only for enums
389\& # whose names do not start with 'bar_'.
390\& h2xs -b 5.5.3 -e '^bar_' -n Lib::Foo foo.h
391.Ve
392.PP
393.Vb 3
394\& # Makefile.PL will look for library -lrpc in
395\& # additional directory /opt/net/lib
396\& h2xs rpcsvc/rusers -L/opt/net/lib -lrpc
397.Ve
398.PP
399.Vb 3
400\& # Extension is DCE::rgynbase
401\& # prefix "sec_rgy_" is dropped from perl function names
402\& h2xs -n DCE::rgynbase -p sec_rgy_ dce/rgynbase
403.Ve
404.PP
405.Vb 6
406\& # Extension is DCE::rgynbase
407\& # prefix "sec_rgy_" is dropped from perl function names
408\& # subroutines are created for sec_rgy_wildcard_name and
409\& # sec_rgy_wildcard_sid
410\& h2xs -n DCE::rgynbase -p sec_rgy_ \e
411\& -s sec_rgy_wildcard_name,sec_rgy_wildcard_sid dce/rgynbase
412.Ve
413.PP
414.Vb 7
415\& # Make XS without defines in perl.h, but with function declarations
416\& # visible from perl.h. Name of the extension is perl1.
417\& # When scanning perl.h, define -DEXT=extern -DdEXT= -DINIT(x)=
418\& # Extra backslashes below because the string is passed to shell.
419\& # Note that a directory with perl header files would
420\& # be added automatically to include path.
421\& h2xs -xAn perl1 -F "-DEXT=extern -DdEXT= -DINIT\e(x\e)=" perl.h
422.Ve
423.PP
424.Vb 2
425\& # Same with function declaration in proto.h as visible from perl.h.
426\& h2xs -xAn perl2 perl.h,proto.h
427.Ve
428.PP
429.Vb 2
430\& # Same but select only functions which match /^av_/
431\& h2xs -M '^av_' -xAn perl2 perl.h,proto.h
432.Ve
433.PP
434.Vb 2
435\& # Same but treat SV* etc as "opaque" types
436\& h2xs -o '^[S]V \e*$' -M '^av_' -xAn perl2 perl.h,proto.h
437.Ve
438.Sh "Extension based on \fI.h\fP and \fI.c\fP files"
439.IX Subsection "Extension based on .h and .c files"
440Suppose that you have some C files implementing some functionality,
441and the corresponding header files. How to create an extension which
442makes this functionality accessible in Perl? The example below
443assumes that the header files are \fIinterface_simple.h\fR and
444\&\fIinterface_hairy.h\fR, and you want the perl module be named as
445\&\f(CW\*(C`Ext::Ension\*(C'\fR. If you need some preprocessor directives and/or
446linking with external libraries, see the flags \f(CW\*(C`\-F\*(C'\fR, \f(CW\*(C`\-L\*(C'\fR and \f(CW\*(C`\-l\*(C'\fR
447in \*(L"\s-1OPTIONS\s0\*(R".
448.IP "Find the directory name" 4
449.IX Item "Find the directory name"
450Start with a dummy run of h2xs:
451.Sp
452.Vb 1
453\& h2xs -Afn Ext::Ension
454.Ve
455.Sp
456The only purpose of this step is to create the needed directories, and
457let you know the names of these directories. From the output you can
458see that the directory for the extension is \fIExt/Ension\fR.
459.IP "Copy C files" 4
460.IX Item "Copy C files"
461Copy your header files and C files to this directory \fIExt/Ension\fR.
462.IP "Create the extension" 4
463.IX Item "Create the extension"
464Run h2xs, overwriting older autogenerated files:
465.Sp
466.Vb 1
467\& h2xs -Oxan Ext::Ension interface_simple.h interface_hairy.h
468.Ve
469.Sp
470h2xs looks for header files \fIafter\fR changing to the extension
471directory, so it will find your header files \s-1OK\s0.
472.IP "Archive and test" 4
473.IX Item "Archive and test"
474As usual, run
475.Sp
476.Vb 5
477\& cd Ext/Ension
478\& perl Makefile.PL
479\& make dist
480\& make
481\& make test
482.Ve
483.IP "Hints" 4
484.IX Item "Hints"
485It is important to do \f(CW\*(C`make dist\*(C'\fR as early as possible. This way you
486can easily \fImerge\fR\|(1) your changes to autogenerated files if you decide
487to edit your \f(CW\*(C`.h\*(C'\fR files and rerun h2xs.
488.Sp
489Do not forget to edit the documentation in the generated \fI.pm\fR file.
490.Sp
491Consider the autogenerated files as skeletons only, you may invent
492better interfaces than what h2xs could guess.
493.Sp
494Consider this section as a guideline only, some other options of h2xs
495may better suit your needs.
496.SH "ENVIRONMENT"
497.IX Header "ENVIRONMENT"
498No environment variables are used.
499.SH "AUTHOR"
500.IX Header "AUTHOR"
501Larry Wall and others
502.SH "SEE ALSO"
503.IX Header "SEE ALSO"
504perl, perlxstut, ExtUtils::MakeMaker, and AutoLoader.
505.SH "DIAGNOSTICS"
506.IX Header "DIAGNOSTICS"
507The usual warnings if it cannot read or write the files involved.
508.SH "LIMITATIONS of \fB\-x\fP"
509.IX Header "LIMITATIONS of -x"
510\&\fIh2xs\fR would not distinguish whether an argument to a C function
511which is of the form, say, \f(CW\*(C`int *\*(C'\fR, is an input, output, or
512input/output parameter. In particular, argument declarations of the
513form
514.PP
515.Vb 3
516\& int
517\& foo(n)
518\& int *n
519.Ve
520.PP
521should be better rewritten as
522.PP
523.Vb 3
524\& int
525\& foo(n)
526\& int &n
527.Ve
528.PP
529if \f(CW\*(C`n\*(C'\fR is an input parameter.
530.PP
531Additionally, \fIh2xs\fR has no facilities to intuit that a function
532.PP
533.Vb 4
534\& int
535\& foo(addr,l)
536\& char *addr
537\& int l
538.Ve
539.PP
540takes a pair of address and length of data at this address, so it is better
541to rewrite this function as
542.PP
543.Vb 11
544\& int
545\& foo(sv)
546\& SV *addr
547\& PREINIT:
548\& STRLEN len;
549\& char *s;
550\& CODE:
551\& s = SvPV(sv,len);
552\& RETVAL = foo(s, len);
553\& OUTPUT:
554\& RETVAL
555.Ve
556.PP
557or alternately
558.PP
559.Vb 5
560\& static int
561\& my_foo(SV *sv)
562\& {
563\& STRLEN len;
564\& char *s = SvPV(sv,len);
565.Ve
566.PP
567.Vb 2
568\& return foo(s, len);
569\& }
570.Ve
571.PP
572.Vb 1
573\& MODULE = foo PACKAGE = foo PREFIX = my_
574.Ve
575.PP
576.Vb 3
577\& int
578\& foo(sv)
579\& SV *sv
580.Ve
581.PP
582See perlxs and perlxstut for additional details.