As regards the optional fourth argument to cpp2xs(), the following hash
keys
/
values
are recognised:
AUTO_INCLUDE
The value specified is automatically inserted into the generated XS
file. (Also, the specified include will be parsed and used iff
AUTOWRAP is set to a true value.) eg:
AUTO_INCLUDE
=>
'#include <my_header.h>'
,
----
AUTOWRAP
Set this to a true value to enable Inline::CPP's AUTOWRAP capability.
eg:
AUTOWRAP
=> 1,
----
BOOT
Specifies C/CPP code to be executed in the XS BOOT section. Corresponds
to the XS parameter. eg:
BOOT
=>
'printf("Hello .. from bootstrap\n");'
,
----
BOOT_F
Specifies a file containing C/CPP code to be executed in the XS BOOT
section.
eg:
BOOT_F
=>
'/home/me/boot_code.ext'
,
----
BUILD_NOISY
Is set to a true value, by
default
. Setting to a false value will
mean that progress messages generated by Inline::CPP are suppressed. eg:
BUILD_NOISY
=> 0,
----
CC
Specify the compiler you want to
use
. It makes sense to assign this
key only
when
WRITE_MAKEFILE_PL is set to a true value. eg:
CC
=>
'g++'
,
----
CCFLAGS
Specify which compiler flags to
use
. (Existing value gets clobbered, so
you'll probably want to re-specify it.) It makes sense to assign this
key only
when
WRITE_MAKEFILE_PL is set to a true value. eg:
CCFLAGS
=>
$Config
{ccflags} .
' -DMY_DEFINE'
,
----
DIST
If set, sets
WRITE_MAKEFILE_PL
=>
'p'
,
WRITE_PM
=> 1,
MANIF
=> 1. eg:
DIST
=> 1,
----
CCFLAGSEX
Add compiler flags to existing flags.
It makes sense to assign this key only
when
WRITE_MAKEFILE_PL is set to
a true value. eg:
CCFLAGSEX
=>
'-DMY_DEFINE'
,
----
CODE
A string containing the CPP code. eg:
CODE
=>
'void foo() {printf("Hello World\n");}'
.
"\n\n"
,
----
EXPORT_ALL
Makes
no
sense to
use
this
unless
WRITE_PM
has
been set.
Places all XSubs except those beginning
with
a
*single
* underscore (but not
multiple underscores) in
@EXPORT
in the generated .pm file. eg:
EXPORT_ALL
=> 1,
----
EXPORT_OK_ALL
Makes
no
sense to
use
this
unless
WRITE_PM
has
been set.
Places all XSubs except those beginning
with
a
*single
* underscore (but not
multiple underscores) in
@EXPORT_OK
in the generated .pm file. eg:
EXPORT_OK_ALL
=> 1,
----
EXPORT_TAGS_ALL
Makes
no
sense to
use
this
unless
WRITE_PM
has
been set.
In the generated .pm file, creates an EXPORT_TAGS tag named
'name'
(where
'name'
is whatever you have specified), and places all XSubs except
those beginning
with
a
*single
* underscore (but not multiple underscores)
in
'name'
. Also places same subs in
@EXPORT_OK
.
eg, the following creates and fills a tag named
'all'
:
EXPORT_TAGS_ALL
=>
'all'
,
----
INC
The value specified is added to the includes search path. It makes
sense to assign this key only
when
AUTOWRAP and/or WRITE_MAKEFILE_PL
are set to a true value. eg:
INC
=>
'-I/my/includes/dir -I/other/includes/dir'
,
INC
=> [
'-I/my/includes/dir'
,
'-I/other/includes/dir'
],
----
LD
Specify the linker you want to
use
.It makes sense to assign this
key only
when
WRITE_MAKEFILE_PL is set to a true value. eg:
LD
=>
'g++'
,
----
LDDLFLAGS
Specify which linker flags to
use
. (Existing value gets clobbered, so
you'll probably want to re-specify it.) It makes sense to assign this
key only
when
WRITE_MAKEFILE_PL is set to a true value. eg:
LDDLFLAGS
=>
"$my_ldopts "
.
$Config
{lddlflags},
----
LIBS
The value(s) specified become the LIBS search path. It makes sense
to assign this key only
if
WRITE_MAKEFILE_PL is set to a true value.
eg:
LIBS
=>
'-L/somewhere -lsomelib -L/elsewhere -lotherlib'
,
LIBS
=> [
'-L/somewhere -lsomelib'
,
'-L/elsewhere -lotherlib'
],
----
MAKE
Specify the make utility you want to
use
. It makes sense to assign this
key only
when
WRITE_MAKEFILE_PL is set to a true value. eg:
MAKE
=>
'pmake'
,
----
MANIF
If true, the MANIFEST file will be written. (It will include all created
files.) eg:
MANIF
=> 1,
----
MYEXTLIB
Specifies a user compiled object that should be linked in.
Corresponds to the MakeMaker parameter. It makes sense to assign this
key only
when
WRITE_MAKEFILE_PL is set to a true value. eg:
MYEXTLIB
=>
'/your/path/yourmodule.so'
,
----
OPTIMIZE
This controls the MakeMaker OPTIMIZE setting.It makes sense to assign
this key only
when
WRITE_MAKEFILE_PL is set to a true value. eg:
OPTIMIZE
=>
'-g'
,
----
PREFIX
Specifies a prefix that will be automatically stripped from C
functions
when
they are bound to Perl. eg:
PREFIX
=>
'FOO_'
,
----
PRE_HEAD
Specifies code that will precede the inclusion of all files specified
in AUTO_INCLUDE (ie EXTERN.h, perl.h, XSUB.h, INLINE.h and anything
else
that might have been added to AUTO_INCLUDE by the user). If the
specified value identifies a file, the contents of that file will be
inserted, otherwise the specified value is inserted.
If the specified value is a string of code, then since that string
ends in
"\n"
(as all code
*should
* terminate
with
at least one
"\n"
),
you will get a warning about an "Unsuccessful
stat
on filename
containing newline"
when
the test
for
the existence of a file that
matches the PRE_HEAD value is conducted.
PRE_HEAD
=>
$code_or_filename
;
----
PREREQ_PM
Makes sense to specify this only
if
WRITE_MAKEFILE_PL is set to true.
The string to which PREREQ_PM is set will be reproduced as is in the
generated Makefile.PL. That is,
if
you specify:
PREREQ_PM
=>
"{'Some::Mod' => '1.23', 'Nother::Mod' => '3.21'}"
,
then the WriteMakefile hash in the generated Makefile.PL will
contain:
PREREQ_PM
=> {
'Some::Mod'
=>
'1.23'
,
'Nother::Mod'
=>
'3.21'
},
----
SRC_LOCATION
Specifies a C file that contains the CPP source code. eg:
SRC_LOCATION
=>
'/home/me/source.ext'
,
----
T
Is false by
default
but, When set to true will
write
a basic
t/00load.t test script in the build directory.
eg:
T
=> 1,
----
TYPEMAPS
The value(s) specified are added to the list of typemaps.
eg:
TYPEMAPS
=>[
'my_typemap'
,
'my_other_typemap'
],
TYPEMAPS
=>
'my_typemap my_other_typemap'
,
----
USE
Must be an array reference, listing the modules that the autogenerated
pm file needs to load (
use
). Makes
no
sense to assign this key
if
WRITE_PM is not set to a true value. eg:
USE
=> [
'Digest::MD5'
,
'LWP::Simple'
];
----
USING
With Inline::C, enables
use
of an alternative parser. But
with
Inline::CPP, there is currently
no
alternative parser available.
USING
=> [
'ParseRegExp'
],
or
USING
=>
'ParseRegExp'
,
----
VERSION
Set this to the version number of the module. It makes sense to assign
this key only
if
WRITE_MAKEFILE_PL and/or WRITE_PM is set to a true
value. eg:
VERSION
=> 0.42,
----
WRITE_MAKEFILE_PL
Set this to to a true value
if
you want the Makefile.PL to be
generated. (You should also assign the
'VERSION'
key to the
correct value
when
WRITE_MAKEFILE_PL is set.) eg:
WRITE_MAKEFILE_PL
=> 1,
WRITE_MAKEFILE_PL
=>
'p'
,
----
WRITE_PM
Set this to a true value
if
you want a .pm file to be generated.
You
'll also need to assign the '
VERSION' key appropriately.
Note that it's a fairly simplistic .pm file -
no
POD,
no
perl
subroutines,
no
exported subs (
unless
EXPORT_ALL or EXPORT_OK_ALL
has
been set),
no
warnings - but it will allow the utilisation of all of
the XSubs in the XS file. eg:
WRITE_PM
=> 1,
----