Book HomeJava and XSLTSearch this book

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.

ccdlflags

ccdlflags

Prints $Config{ccdlflags}.

ccflags

ccflags

Prints $Config{ccflags}.

ccopts

ccopts

Combines perl_inc, ccflags, and ccdlflags.

ldopts

ldopts

Outputs arguments for linking the Perl library and extensions to your application. When invoked as:

perl -MExtUtils::Embed -e ldopts -

the following options are recognized:

-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.

Any additional arguments found before the -- token are taken as the names of modules to generate code for. Can also be called with parameters:

'ldopts($std,[@modules],[@link_args],$path)'

When called this way, returns the argument string rather than 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.

perl_inc

perl_inc

For including Perl header files. For example, if you say:

perl -MExtUtils::Embed -eperl_inc

the module prints the following:

-I$Config{archlibexp}/CORE
xsi_body

xsi_body (modules)

Returns string of calls to newXS that glue the module bootstrap function to boot_ModuleName for each module in modules.

xsi_header

xsi_header

Returns a string defining the same EXTERN_C macro as perlmain.c; also #include s perl.h and EXTERN.h.

xsinit

xsinit

Generates C/C++ code for the XS initializer function. When invoked as:

perl -MExtUtils::Embed -e xsinit -

the following options are recognized:

-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.

xsi_protos

xsi_protos (modules)

Returns string of boot_$ModuleName prototypes for each module in modules.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.