📄 extutils::cbuilder.3
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Vb \" Begin verbatim text.ft CW.nf.ne \\$1...de Ve \" End verbatim text.ft R.fi...\" Set up some character translations and predefined strings. \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote. \*(C+ will.\" give a nicer C++. Capital omega is used to do unbreakable dashes and.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\. ds -- \(*W-. ds PI pi. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch. ds L" "". ds R" "". ds C` "". ds C' ""'br\}.el\{\. ds -- \|\(em\|. ds PI \(*p. ds L" ``. ds R" '''br\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el .ds Aq '.\".\" If the F register is turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD. Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\. de IX. tm Index:\\$1\t\\n%\t"\\$2"... nr % 0. rr F.\}.el \{\. de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear. Run. Save yourself. No user-serviceable parts.. \" fudge factors for nroff and troff.if n \{\. ds #H 0. ds #V .8m. ds #F .3m. ds #[ \f1. ds #] \fP.\}.if t \{\. ds #H ((1u-(\\\\n(.fu%2u))*.13m). ds #V .6m. ds #F 0. ds #[ \&. ds #] \&.\}. \" simple accents for nroff and troff.if n \{\. ds ' \&. ds ` \&. ds ^ \&. ds , \&. ds ~ ~. ds /.\}.if t \{\. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u". ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}. \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E. \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'. \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\. ds : e. ds 8 ss. ds o a. ds d- d\h'-1'\(ga. ds D- D\h'-1'\(hy. ds th \o'bp'. ds Th \o'LP'. ds ae ae. ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "ExtUtils::CBuilder 3".TH ExtUtils::CBuilder 3 "2007-12-18" "perl v5.10.0" "Perl Programmers Reference Guide".\" For nroff, turn off justification. Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.SH "NAME"ExtUtils::CBuilder \- Compile and link C code for Perl modules.SH "SYNOPSIS".IX Header "SYNOPSIS".Vb 1\& use ExtUtils::CBuilder;\&\& my $b = ExtUtils::CBuilder\->new(%options);\& $obj_file = $b\->compile(source => \*(AqMyModule.c\*(Aq);\& $lib_file = $b\->link(objects => $obj_file);.Ve.SH "DESCRIPTION".IX Header "DESCRIPTION"This module can build the C portions of Perl modules by invoking theappropriate compilers and linkers in a cross-platform manner. It wasmotivated by the \f(CW\*(C`Module::Build\*(C'\fR project, but may be useful for otherpurposes as well. However, it is \fInot\fR intended as a generalcross-platform interface to all your C building needs. That wouldhave been a much more ambitious goal!.SH "METHODS".IX Header "METHODS".IP "new" 4.IX Item "new"Returns a new \f(CW\*(C`ExtUtils::CBuilder\*(C'\fR object. A \f(CW\*(C`config\*(C'\fR parameterlets you override \f(CW\*(C`Config.pm\*(C'\fR settings for all operations performedby the object, as in the following example:.Sp.Vb 3\& # Use a different compiler than Config.pm says\& my $b = ExtUtils::CBuilder\->new( config =>\& { ld => \*(Aqgcc\*(Aq } );.Ve.SpA \f(CW\*(C`quiet\*(C'\fR parameter tells \f(CW\*(C`CBuilder\*(C'\fR to not print its \f(CW\*(C`system()\*(C'\fRcommands before executing them:.Sp.Vb 2\& # Be quieter than normal\& my $b = ExtUtils::CBuilder\->new( quiet => 1 );.Ve.IP "have_compiler" 4.IX Item "have_compiler"Returns true if the current system has a working C compiler andlinker, false otherwise. To determine this, we actually compile andlink a sample C library..IP "compile" 4.IX Item "compile"Compiles a C source file and produces an object file. The name of theobject file is returned. The source file is specified in a \f(CW\*(C`source\*(C'\fRparameter, which is required; the other parameters listed below areoptional..RS 4.ie n .IP """object_file""" 4.el .IP "\f(CWobject_file\fR" 4.IX Item "object_file"Specifies the name of the output file to create. Otherwise the\&\f(CW\*(C`object_file()\*(C'\fR method will be consulted, passing it the name of the\&\f(CW\*(C`source\*(C'\fR file..ie n .IP """include_dirs""" 4.el .IP "\f(CWinclude_dirs\fR" 4.IX Item "include_dirs"Specifies any additional directories in which to search for headerfiles. May be given as a string indicating a single directory, or asa list reference indicating multiple directories..ie n .IP """extra_compiler_flags""" 4.el .IP "\f(CWextra_compiler_flags\fR" 4.IX Item "extra_compiler_flags"Specifies any additional arguments to pass to the compiler. Should begiven as a list reference containing the arguments individually, or ifthis is not possible, as a string containing all the argumentstogether..RE.RS 4.SpThe operation of this method is also affected by the\&\f(CW\*(C`archlibexp\*(C'\fR, \f(CW\*(C`cccdlflags\*(C'\fR, \f(CW\*(C`ccflags\*(C'\fR, \f(CW\*(C`optimize\*(C'\fR, and \f(CW\*(C`cc\*(C'\fRentries in \f(CW\*(C`Config.pm\*(C'\fR..RE.IP "link" 4.IX Item "link"Invokes the linker to produce a library file from object files. Inscalar context, the name of the library file is returned. In listcontext, the library file and any temporary files created arereturned. A required \f(CW\*(C`objects\*(C'\fR parameter contains the name of theobject files to process, either in a string (for one object file) orlist reference (for one or more files). The following parameters areoptional:.RS 4.IP "lib_file" 4.IX Item "lib_file"Specifies the name of the output library file to create. Otherwisethe \f(CW\*(C`lib_file()\*(C'\fR method will be consulted, passing it the name ofthe first entry in \f(CW\*(C`objects\*(C'\fR..IP "module_name" 4.IX Item "module_name"Specifies the name of the Perl module that will be created by linking.On platforms that need to do prelinking (Win32, \s-1OS/2\s0, etc.) this is arequired parameter..IP "extra_linker_flags" 4.IX Item "extra_linker_flags"Any additional flags you wish to pass to the linker..RE.RS 4.SpOn platforms where \f(CW\*(C`need_prelink()\*(C'\fR returns true, \f(CW\*(C`prelink()\*(C'\fRwill be called automatically..SpThe operation of this method is also affected by the \f(CW\*(C`lddlflags\*(C'\fR,\&\f(CW\*(C`shrpenv\*(C'\fR, and \f(CW\*(C`ld\*(C'\fR entries in \f(CW\*(C`Config.pm\*(C'\fR..RE.IP "link_executable" 4.IX Item "link_executable"Invokes the linker to produce an executable file from object files. Inscalar context, the name of the executable file is returned. In listcontext, the executable file and any temporary files created arereturned. A required \f(CW\*(C`objects\*(C'\fR parameter contains the name of theobject files to process, either in a string (for one object file) orlist reference (for one or more files). The optional parameters arethe same as \f(CW\*(C`link\*(C'\fR with exception for.RS 4.IP "exe_file" 4.IX Item "exe_file"Specifies the name of the output executable file to create. Otherwisethe \f(CW\*(C`exe_file()\*(C'\fR method will be consulted, passing it the name of thefirst entry in \f(CW\*(C`objects\*(C'\fR..RE.RS 4.RE.IP "object_file" 4.IX Item "object_file".Vb 1\& my $object_file = $b\->object_file($source_file);.Ve.SpConverts the name of a C source file to the most natural name of anoutput object file to create from it. For instance, on Unix thesource file \fIfoo.c\fR would result in the object file \fIfoo.o\fR..IP "lib_file" 4.IX Item "lib_file".Vb 1\& my $lib_file = $b\->lib_file($object_file);.Ve.SpConverts the name of an object file to the most natural name of aoutput library file to create from it. For instance, on Mac \s-1OS\s0 X theobject file \fIfoo.o\fR would result in the library file \fIfoo.bundle\fR..IP "exe_file" 4.IX Item "exe_file".Vb 1\& my $exe_file = $b\->exe_file($object_file);.Ve.SpConverts the name of an object file to the most natural name of anexecutable file to create from it. For instance, on Mac \s-1OS\s0 X theobject file \fIfoo.o\fR would result in the executable file \fIfoo\fR, andon Windows it would result in \fIfoo.exe\fR..IP "prelink" 4.IX Item "prelink"On certain platforms like Win32, \s-1OS/2\s0, \s-1VMS\s0, and \s-1AIX\s0, it is necessaryto perform some actions before invoking the linker. The\&\f(CW\*(C`ExtUtils::Mksymlists\*(C'\fR module does this, writing files used by thelinker during the creation of shared libraries for dynamic extensions.The names of any files written will be returned as a list..SpSeveral parameters correspond to \f(CW\*(C`ExtUtils::Mksymlists::Mksymlists()\*(C'\fRoptions, as follows:.Sp.Vb 10\& Mksymlists() prelink() type\& \-\-\-\-\-\-\-\-\-\-\-\-\-|\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-|\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\& NAME | dl_name | string (required)\& DLBASE | dl_base | string\& FILE | dl_file | string\& DL_VARS | dl_vars | array reference\& DL_FUNCS | dl_funcs | hash reference\& FUNCLIST | dl_func_list | array reference\& IMPORTS | dl_imports | hash reference\& VERSION | dl_version | string.Ve.SpPlease see the documentation for \f(CW\*(C`ExtUtils::Mksymlists\*(C'\fR for thedetails of what these parameters do..IP "need_prelink" 4.IX Item "need_prelink"Returns true on platforms where \f(CW\*(C`prelink()\*(C'\fR should be calledduring linking, and false otherwise..IP "extra_link_args_after_prelink" 4.IX Item "extra_link_args_after_prelink"Returns list of extra arguments to give to the link command; the argumentsare the same as for \fIprelink()\fR, with addition of array reference to theresults of \fIprelink()\fR; this reference is indexed by key \f(CW\*(C`prelink_res\*(C'\fR..SH "TO DO".IX Header "TO DO"Currently this has only been tested on Unix and doesn't contain any ofthe Windows-specific code from the \f(CW\*(C`Module::Build\*(C'\fR project. I'll dothat next..SH "HISTORY".IX Header "HISTORY"This module is an outgrowth of the \f(CW\*(C`Module::Build\*(C'\fR project, to whichthere have been many contributors. Notably, Randy W. Sims submittedlots of code to support 3 compilers on Windows and helped with variousother platform-specific issues. Ilya Zakharevich has contributedfixes for \s-1OS/2\s0; John E. Malmberg and Peter Prymmer have done likewisefor \s-1VMS\s0..SH "AUTHOR".IX Header "AUTHOR"Ken Williams, kwilliams@cpan.org.SH "COPYRIGHT".IX Header "COPYRIGHT"Copyright (c) 2003\-2005 Ken Williams. All rights reserved..PPThis library is free software; you can redistribute it and/ormodify it under the same terms as Perl itself..SH "SEE ALSO".IX Header "SEE ALSO"\&\fIperl\fR\|(1), \fIModule::Build\fR\|(3)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -