Added an example showing use of %pragmas and init/shutdown code injection.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7452 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
1935c2d69d
commit
ce5e38367c
3 changed files with 41 additions and 0 deletions
5
Examples/php4/pragmas/BUILD.sh
Executable file
5
Examples/php4/pragmas/BUILD.sh
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
${SWIG:=swig} -php4 -make example.i
|
||||
make
|
||||
php -d extension_dir=. runme.php4
|
||||
31
Examples/php4/pragmas/example.i
Normal file
31
Examples/php4/pragmas/example.i
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/* File : example.i */
|
||||
%module example
|
||||
|
||||
%init{
|
||||
zend_printf("This was %%init\n");
|
||||
}
|
||||
|
||||
%minit{
|
||||
zend_printf("This was %%minit\n");
|
||||
}
|
||||
|
||||
%mshutdown{
|
||||
zend_printf("This was %%shutdown\n");
|
||||
}
|
||||
|
||||
%rinit{
|
||||
zend_printf("This was %%rinit\n");
|
||||
}
|
||||
|
||||
%rshutdown{
|
||||
zend_printf("This was %%rshutdown\n");
|
||||
}
|
||||
|
||||
%pragma(php4) include="hi.php";
|
||||
|
||||
%pragma(php4) code="
|
||||
# This code is inserted into example.php
|
||||
echo \"this was php4 code\\n\";
|
||||
"
|
||||
|
||||
%pragma(php4) phpinfo="php_info_print_table_start();"
|
||||
5
Examples/php4/pragmas/runme.php4
Executable file
5
Examples/php4/pragmas/runme.php4
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
require "example.php";
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue