section numbering update after running makefile
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7484 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
2a1b4e0ce6
commit
663f4ed451
3 changed files with 66 additions and 51 deletions
|
|
@ -11,7 +11,7 @@
|
|||
<!-- INDEX -->
|
||||
<div class="sectiontoc">
|
||||
<ul>
|
||||
<li><a href="#Php_nn1">Generating PHP4Extensions</a>
|
||||
<li><a href="#Php_nn1">Generating PHP4 Extensions</a>
|
||||
<ul>
|
||||
<li><a href="#Php_nn1_1">Building a loadable extension</a>
|
||||
<li><a href="#Php_nn1_2">Building extensions into PHP</a>
|
||||
|
|
@ -27,7 +27,6 @@
|
|||
<li><a href="#Php_nn2_6">Structures and C++ classes</a>
|
||||
<ul>
|
||||
<li><a href="#Php_nn2_6_1">Using <tt>-noproxy</tt></a>
|
||||
<li><a href="#Php_nn2_6_2">Constructors and Destructors</a>
|
||||
<li><a href="#Php_nn2_6_3">Static Member Variables</a>
|
||||
<li><a href="#Php_nn2_6_4">Static Member Functions</a>
|
||||
</ul>
|
||||
|
|
@ -37,6 +36,8 @@
|
|||
</div>
|
||||
<!-- INDEX -->
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
<b>Caution: This chapter (and module!) is still under construction</b>
|
||||
</p>
|
||||
|
|
@ -66,6 +67,7 @@ each script), you will need the complete PHP source tree available.
|
|||
|
||||
<H2><a name="Php_nn1"></a>24.1 Generating PHP4 Extensions</H2>
|
||||
|
||||
|
||||
<p>
|
||||
To build a PHP4 extension, run swig using the <tt>-php4</tt> option as
|
||||
follows :
|
||||
|
|
@ -103,6 +105,7 @@ the '-phpfull' command line switch to select the second build method.
|
|||
|
||||
<H3><a name="Php_nn1_1"></a>24.1.1 Building a loadable extension</H3>
|
||||
|
||||
|
||||
<p>
|
||||
There are two methods to build the extension as a dynamically loaded
|
||||
module: using standard compilation utilities (make, gcc), or using
|
||||
|
|
@ -192,6 +195,7 @@ additional optional arguments:
|
|||
|
||||
<H3><a name="Php_nn1_2"></a>24.1.2 Building extensions into PHP</H3>
|
||||
|
||||
|
||||
<p>
|
||||
This method, selected with the <tt>-phpfull</tt> command line switch, involves
|
||||
rebuilding the entire php source tree. Whilst more complicated to build,
|
||||
|
|
@ -249,6 +253,7 @@ does not have the 'dl' command as used above.
|
|||
|
||||
<H3><a name="Php_nn1_3"></a>24.1.3 Using PHP4 Extensions</H3>
|
||||
|
||||
|
||||
<p>
|
||||
To test the extension from a PHP script, you need to load it first. You do
|
||||
this by putting the line,
|
||||
|
|
@ -271,6 +276,7 @@ attempts to do the <tt>dl()</tt> call for you:
|
|||
|
||||
<H2><a name="Php_nn2"></a>24.2 Basic PHP4 interface</H2>
|
||||
|
||||
|
||||
<p>
|
||||
It is important to understand that PHP uses a single global namespace
|
||||
into which all symbols from extension modules are loaded. It is quite
|
||||
|
|
@ -405,6 +411,7 @@ Apologies, this paragraph needs rewritting to make some sense. )
|
|||
|
||||
<H3><a name="Php_nn2_2"></a>24.2.2 Global Variables</H3>
|
||||
|
||||
|
||||
<p>
|
||||
Because PHP4 does not provide a mechanism to intercept access and
|
||||
assignment of global variables, global variables are supported through
|
||||
|
|
@ -453,6 +460,7 @@ At this time SWIG does not support custom accessor methods.
|
|||
|
||||
<H3><a name="Php_nn2_3"></a>24.2.3 Functions</H3>
|
||||
|
||||
|
||||
<p>
|
||||
C functions are converted into PHP functions. Default/optional arguments are
|
||||
also allowed. An interface file like this :
|
||||
|
|
@ -503,6 +511,7 @@ print $s; # The value of $s was not changed.
|
|||
|
||||
<H3><a name="Php_nn2_4"></a>24.2.4 Overloading</H3>
|
||||
|
||||
|
||||
<p>
|
||||
Although PHP4 does not support overloading functions natively, swig
|
||||
will generate dispatch functions which will use <tt>%typecheck</tt>
|
||||
|
|
@ -556,6 +565,7 @@ taking the integer argument.
|
|||
|
||||
<H3><a name="Php_nn2_5"></a>24.2.5 Pointers and References</H3>
|
||||
|
||||
|
||||
<p>
|
||||
Pointers to C/C++ objects <b>no longer</b> represented as character
|
||||
strings such as:<tt>_523d3f4_Circle_p</tt>, instead they are represented
|
||||
|
|
@ -687,6 +697,7 @@ variable, or assigning <tt>NULL</tt> to a variable.
|
|||
|
||||
<H3><a name="Php_nn2_6"></a>24.2.6 Structures and C++ classes</H3>
|
||||
|
||||
|
||||
<p>
|
||||
By default, SWIG represents structs and C++ classes using a PHP4
|
||||
class. The PHP4 class is implemented entirely using the Zend C API so
|
||||
|
|
@ -745,6 +756,7 @@ Member variables and methods are accessed using the <tt>-></tt> operator.
|
|||
|
||||
<H4><a name="Php_nn2_6_1"></a>24.2.6.1 Using <tt>-noproxy</tt></H4>
|
||||
|
||||
|
||||
<p>
|
||||
The <tt>-noproxy</tt> option flattens the object structure and
|
||||
generates collections of named functions. The above example results
|
||||
|
|
@ -808,7 +820,8 @@ the programmer can either reassign the variable or call
|
|||
<tt>unset($v)</tt>
|
||||
</p>
|
||||
|
||||
<H4><a name="Php_nn2_6_3"></a>24.2.6.3 Static Member Variables</H4>
|
||||
<H4><a name="Php_nn2_6_3"></a>24.2.6.2 Static Member Variables</H4>
|
||||
|
||||
|
||||
<p>
|
||||
Class variables are not supported in PHP. Static member variables are
|
||||
|
|
@ -847,7 +860,8 @@ Ko::threats(10);
|
|||
echo "There has now been " . Ko::threats() . " threats\n";
|
||||
|
||||
</pre></div>
|
||||
<H4><a name="Php_nn2_6_4"></a>24.2.6.4 Static Member Functions</H4>
|
||||
<H4><a name="Php_nn2_6_4"></a>24.2.6.3 Static Member Functions</H4>
|
||||
|
||||
|
||||
<p>
|
||||
Class functions are supported in PHP using the
|
||||
|
|
@ -870,6 +884,7 @@ Ko::threats();
|
|||
|
||||
<H3><a name="Php_nn2_7"></a>24.2.7 PHP4 Pragmas, Startup and Shutdown code</H3>
|
||||
|
||||
|
||||
<p>
|
||||
To place PHP code in the generated "example.php" file one can use the
|
||||
<b>code</b> pragma. The code is inserted after loading the shared
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue