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:
Kevin Ruland 2005-09-16 18:19:56 +00:00
commit ce5e38367c
3 changed files with 41 additions and 0 deletions

5
Examples/php4/pragmas/BUILD.sh Executable file
View file

@ -0,0 +1,5 @@
#! /bin/sh -e
${SWIG:=swig} -php4 -make example.i
make
php -d extension_dir=. runme.php4

View 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();"

View file

@ -0,0 +1,5 @@
<?php
require "example.php";
?>