Edit D:\app\Administrator\product\11.2.0\dbhome_1\perl\html\lib\ExtUtils\CBuilder.html
<?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>ExtUtils::CBuilder - Compile and link C code for Perl modules</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rev="made" href="mailto:" /> </head> <body style="background-color: white"> <table border="0" width="100%" cellspacing="0" cellpadding="3"> <tr><td class="block" style="background-color: #cccccc" valign="middle"> <big><strong><span class="block"> ExtUtils::CBuilder - Compile and link C code for Perl modules</span></strong></big> </td></tr> </table> <!-- INDEX BEGIN --> <div name="index"> <p><a name="__index__"></a></p> <ul> <li><a href="#name">NAME</a></li> <li><a href="#synopsis">SYNOPSIS</a></li> <li><a href="#description">DESCRIPTION</a></li> <li><a href="#methods">METHODS</a></li> <li><a href="#to_do">TO DO</a></li> <li><a href="#history">HISTORY</a></li> <li><a href="#author">AUTHOR</a></li> <li><a href="#copyright">COPYRIGHT</a></li> <li><a href="#see_also">SEE ALSO</a></li> </ul> <hr name="index" /> </div> <!-- INDEX END --> <p> </p> <h1><a name="name">NAME</a></h1> <p>ExtUtils::CBuilder - Compile and link C code for Perl modules</p> <p> </p> <hr /> <h1><a name="synopsis">SYNOPSIS</a></h1> <pre> use ExtUtils::CBuilder;</pre> <pre> my $b = ExtUtils::CBuilder->new(%options); $obj_file = $b->compile(source => 'MyModule.c'); $lib_file = $b->link(objects => $obj_file);</pre> <p> </p> <hr /> <h1><a name="description">DESCRIPTION</a></h1> <p>This module can build the C portions of Perl modules by invoking the appropriate compilers and linkers in a cross-platform manner. It was motivated by the <code>Module::Build</code> project, but may be useful for other purposes as well. However, it is <em>not</em> intended as a general cross-platform interface to all your C building needs. That would have been a much more ambitious goal!</p> <p> </p> <hr /> <h1><a name="methods">METHODS</a></h1> <dl> <dt><strong><a name="new" class="item">new</a></strong> <dd> <p>Returns a new <code>ExtUtils::CBuilder</code> object. A <code>config</code> parameter lets you override <code>Config.pm</code> settings for all operations performed by the object, as in the following example:</p> </dd> <dd> <pre> # Use a different compiler than Config.pm says my $b = ExtUtils::CBuilder->new( config => { ld => 'gcc' } );</pre> </dd> <dd> <p>A <code>quiet</code> parameter tells <code>CBuilder</code> to not print its <a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/pod/perlfunc.html#system"><code>system()</code></a> commands before executing them:</p> </dd> <dd> <pre> # Be quieter than normal my $b = ExtUtils::CBuilder->new( quiet => 1 );</pre> </dd> </li> <dt><strong><a name="have_compiler" class="item">have_compiler</a></strong> <dd> <p>Returns true if the current system has a working C compiler and linker, false otherwise. To determine this, we actually compile and link a sample C library.</p> </dd> </li> <dt><strong><a name="compile" class="item">compile</a></strong> <dd> <p>Compiles a C source file and produces an object file. The name of the object file is returned. The source file is specified in a <code>source</code> parameter, which is required; the other parameters listed below are optional.</p> </dd> <dl> <dt><strong><a name="object_file" class="item"><code>object_file</code></a></strong> <dd> <p>Specifies the name of the output file to create. Otherwise the <a href="#object_file"><code>object_file()</code></a> method will be consulted, passing it the name of the <code>source</code> file.</p> </dd> </li> <dt><strong><a name="include_dirs" class="item"><code>include_dirs</code></a></strong> <dd> <p>Specifies any additional directories in which to search for header files. May be given as a string indicating a single directory, or as a list reference indicating multiple directories.</p> </dd> </li> <dt><strong><a name="extra_compiler_flags" class="item"><code>extra_compiler_flags</code></a></strong> <dd> <p>Specifies any additional arguments to pass to the compiler. Should be given as a list reference containing the arguments individually, or if this is not possible, as a string containing all the arguments together.</p> </dd> </li> </dl> <p>The operation of this method is also affected by the <code>archlibexp</code>, <code>cccdlflags</code>, <code>ccflags</code>, <code>optimize</code>, and <code>cc</code> entries in <code>Config.pm</code>.</p> <dt><strong><a name="link" class="item">link</a></strong> <dd> <p>Invokes the linker to produce a library file from object files. In scalar context, the name of the library file is returned. In list context, the library file and any temporary files created are returned. A required <code>objects</code> parameter contains the name of the object files to process, either in a string (for one object file) or list reference (for one or more files). The following parameters are optional:</p> </dd> <dl> <dt><strong><a name="lib_file" class="item">lib_file</a></strong> <dd> <p>Specifies the name of the output library file to create. Otherwise the <a href="#lib_file"><code>lib_file()</code></a> method will be consulted, passing it the name of the first entry in <code>objects</code>.</p> </dd> </li> <dt><strong><a name="module_name" class="item">module_name</a></strong> <dd> <p>Specifies the name of the Perl module that will be created by linking. On platforms that need to do prelinking (Win32, OS/2, etc.) this is a required parameter.</p> </dd> </li> <dt><strong><a name="extra_linker_flags" class="item">extra_linker_flags</a></strong> <dd> <p>Any additional flags you wish to pass to the linker.</p> </dd> </li> </dl> <p>On platforms where <a href="#need_prelink"><code>need_prelink()</code></a> returns true, <a href="#prelink"><code>prelink()</code></a> will be called automatically.</p> <p>The operation of this method is also affected by the <code>lddlflags</code>, <code>shrpenv</code>, and <code>ld</code> entries in <code>Config.pm</code>.</p> <dt><strong><a name="link_executable" class="item">link_executable</a></strong> <dd> <p>Invokes the linker to produce an executable file from object files. In scalar context, the name of the executable file is returned. In list context, the executable file and any temporary files created are returned. A required <code>objects</code> parameter contains the name of the object files to process, either in a string (for one object file) or list reference (for one or more files). The optional parameters are the same as <a href="#link"><code>link</code></a> with exception for</p> </dd> <dl> <dt><strong><a name="exe_file" class="item">exe_file</a></strong> <dd> <p>Specifies the name of the output executable file to create. Otherwise the <a href="#exe_file"><code>exe_file()</code></a> method will be consulted, passing it the name of the first entry in <code>objects</code>.</p> </dd> </li> </dl> <dt><strong>object_file</strong> <dd> <pre> my $object_file = $b->object_file($source_file);</pre> </dd> <dd> <p>Converts the name of a C source file to the most natural name of an output object file to create from it. For instance, on Unix the source file <em class="file">foo.c</em> would result in the object file <em class="file">foo.o</em>.</p> </dd> <dt><strong>lib_file</strong> <dd> <pre> my $lib_file = $b->lib_file($object_file);</pre> </dd> <dd> <p>Converts the name of an object file to the most natural name of a output library file to create from it. For instance, on Mac OS X the object file <em class="file">foo.o</em> would result in the library file <em class="file">foo.bundle</em>.</p> </dd> <dt><strong>exe_file</strong> <dd> <pre> my $exe_file = $b->exe_file($object_file);</pre> </dd> <dd> <p>Converts the name of an object file to the most natural name of an executable file to create from it. For instance, on Mac OS X the object file <em class="file">foo.o</em> would result in the executable file <em class="file">foo</em>, and on Windows it would result in <em class="file">foo.exe</em>.</p> </dd> <dt><strong><a name="prelink" class="item">prelink</a></strong> <dd> <p>On certain platforms like Win32, OS/2, VMS, and AIX, it is necessary to perform some actions before invoking the linker. The <code>ExtUtils::Mksymlists</code> module does this, writing files used by the linker during the creation of shared libraries for dynamic extensions. The names of any files written will be returned as a list.</p> </dd> <dd> <p>Several parameters correspond to <code>ExtUtils::Mksymlists::Mksymlists()</code> options, as follows:</p> </dd> <dd> <pre> 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</pre> </dd> <dd> <p>Please see the documentation for <code>ExtUtils::Mksymlists</code> for the details of what these parameters do.</p> </dd> </li> <dt><strong><a name="need_prelink" class="item">need_prelink</a></strong> <dd> <p>Returns true on platforms where <a href="#prelink"><code>prelink()</code></a> should be called during linking, and false otherwise.</p> </dd> </li> <dt><strong><a name="extra_link_args_after_prelink" class="item">extra_link_args_after_prelink</a></strong> <dd> <p>Returns list of extra arguments to give to the link command; the arguments are the same as for <a href="#prelink"><code>prelink()</code></a>, with addition of array reference to the results of <a href="#prelink"><code>prelink()</code></a>; this reference is indexed by key <code>prelink_res</code>.</p> </dd> </li> </dl> <p> </p> <hr /> <h1><a name="to_do">TO DO</a></h1> <p>Currently this has only been tested on Unix and doesn't contain any of the Windows-specific code from the <code>Module::Build</code> project. I'll do that next.</p> <p> </p> <hr /> <h1><a name="history">HISTORY</a></h1> <p>This module is an outgrowth of the <code>Module::Build</code> project, to which there have been many contributors. Notably, Randy W. Sims submitted lots of code to support 3 compilers on Windows and helped with various other platform-specific issues. Ilya Zakharevich has contributed fixes for OS/2; John E. Malmberg and Peter Prymmer have done likewise for VMS.</p> <p> </p> <hr /> <h1><a name="author">AUTHOR</a></h1> <p>Ken Williams, <a href="mailto:kwilliams@cpan.org">kwilliams@cpan.org</a></p> <p> </p> <hr /> <h1><a name="copyright">COPYRIGHT</a></h1> <p>Copyright (c) 2003-2005 Ken Williams. All rights reserved.</p> <p>This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p> <p> </p> <hr /> <h1><a name="see_also">SEE ALSO</a></h1> <p><code>perl(1)</code>, Module::Build(3)</p> <table border="0" width="100%" cellspacing="0" cellpadding="3"> <tr><td class="block" style="background-color: #cccccc" valign="middle"> <big><strong><span class="block"> ExtUtils::CBuilder - Compile and link C code for Perl modules</span></strong></big> </td></tr> </table> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de