8.70. ExtUtils::Embed
Generally called from the Makefile that
builds your application to provide initialization functions for
embedding Perl code in C or C++ applications. For example:
perl -MExtUtils::Embed -e xsinit
perl -MExtUtils::Embed -e ldopts
Uses the configuration information kept in
Config.pm (see the Config module above). Exports
the following functions.
Prints $Config{ccdlflags}.
ccdlflags
Prints $Config{ccflags}.
ccflags
Combines perl_inc, ccflags, and
ccopts
ccdlflags.
Outputs arguments for linking the Perl library and extensions to your
ldopts
application. When invoked as:
the following options are recognized:perl -MExtUtils::Embed -e ldopts -
- -std
- Outputs arguments for linking the Perl library and any extensions
linked with the current Perl. - -I <path1:path2>
- Search path for ModuleName.a archives. Default
is @INC. - -- <list of linker args>
- Additional linker arguments to be considered.
the names of modules to generate code for. Can also be called with
parameters:
When called this way, returns the argument string rather than''ldopts($std,[@modules],[@link_args],$path)''
printing it to STDOUT. The optional parameters are:
- $std
- Boolean, equivalent to the -std option.
- [@modules]
- Array reference. Equivalent to adding module names before the --
token. - [@link_args]
- Array reference. Equivalent to adding linker arguments after the
-- token. - $path
- Equivalent to the -I option.
For including Perl header files. For example, if you say:
perl_inc
the module prints the following:perl -MExtUtils::Embed -eperl_inc
-I$Config{archlibexp}/CORE
Returns string of calls to newXS that glue the
xsi_body (modules)
module bootstrap function to boot_ModuleName for
each module in modules.
Returns a string defining the same EXTERN_C macro as
xsi_header
perlmain.c; also #include s
perl.h and EXTERN.h.
Generates C/C++ code for the XS initializer function. When invoked
xsinit
as:
the following options are recognized:perl -MExtUtils::Embed -e xsinit -
- -o [filename]
- Prints to the filename specified. Defaults to
perlxsi.c. If
filename is STDOUT, prints to standard
output. - -std
- Writes code for extensions that are linked with the current Perl.Any additional arguments are expected to be names of modules to
generate code for. Can also be called with parameters:''xsinit($filename,$std,[@modules])''
When called this way, the following optional parameters are accepted:- $filename
- Equivalent to the -o option.
- $std
- Boolean. Equivalent to the -std option.
- [@modules]
- An array reference. Equivalent to adding module names after the
-- token.
Returns string of boot_$ModuleName prototypes for
xsi_protos (modules)
each module in modules.