<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>The ext_skel script</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="internals2.buildsys.environment.html">Building PHP for extension development</a></div> <div class="next" style="text-align: right; float: right;"><a href="internals2.buildsys.configunix.html">Talking to the UNIX build system: config.m4</a></div> <div class="up"><a href="internals2.buildsys.html">The PHP 5 build system</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="internals2.buildsys.skeleton" class="sect1"> <h2 class="title">The ext_skel script</h2> <p class="para"> A PHP extension is composed of several files common to all extensions. As the details of many of those files are similar from extension to extension, it can be laborious to duplicate the content for each one. Fortunately, there is a script which can do all of the initial setup for you. It's called <strong class="command">ext_skel</strong>, and it's been distributed with PHP since 4.0. </p> <p class="para"> Running <strong class="command">ext_skel</strong> with no parameters produces this output in PHP 5.2.2: <div class="example-contents screen"> <div class="cdata"><pre> php-5.2.2/ext$ ./ext_skel ./ext_skel --extname=module [--proto=file] [--stubs=file] [--xml[=file]] [--skel=dir] [--full-xml] [--no-help] --extname=module module is the name of your extension --proto=file file contains prototypes of functions to create --stubs=file generate only function stubs in file --xml generate xml documentation to be added to phpdoc-cvs --skel=dir path to the skeleton directory --full-xml generate xml documentation for a self-contained extension (not yet implemented) --no-help don't try to be nice and create comments in the code and helper functions to test if the module compiled </pre></div></div> Generally, when developing a new extension the only parameters you will be interested in are <em>--extname</em> and <em>--no-help</em>. Unless you are already experienced with the structure of an extension, you will <em class="emphasis">not</em> want to use <em>--no-help</em>; specifying it causes <strong class="command">ext_skel</strong> to leave out many helpful comments in the files it generates. </p> <p class="para"> This leaves you with <em>--extname</em>, which tells <strong class="command">ext_skel</strong> what the name of your extension is. This "name" is an all-lowercase identifier containing only letters and underscores which is unique among everything in the <var class="filename">ext/</var> folder of your PHP distribution. </p> <p class="para"> The <em>--proto</em> option is intended to allow the developer to specify a header file from which a set of PHP functions will be created, ostensibly for the purpose of developing an extension based on a library, but it often functions poorly with most modern header files. A test run on the <var class="filename">zlib.h</var> header resulted in a very large number of empty and nonsense prototypes in the <strong class="command">ext_skel</strong> output files. The <em>--xml</em> and <em>--full-xml</em> options are entirely nonfunctional thus far. The <em>--skel</em> option can be used to specify a modified set of skeleton files to work from, a topic which is beyond the scope of this section. </p> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="internals2.buildsys.environment.html">Building PHP for extension development</a></div> <div class="next" style="text-align: right; float: right;"><a href="internals2.buildsys.configunix.html">Talking to the UNIX build system: config.m4</a></div> <div class="up"><a href="internals2.buildsys.html">The PHP 5 build system</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>