diff --git a/SWIG/Examples/php4/simple/example.c b/SWIG/Examples/php4/simple/example.c index 1c2af789c..cdbdd4873 100644 --- a/SWIG/Examples/php4/simple/example.c +++ b/SWIG/Examples/php4/simple/example.c @@ -3,6 +3,10 @@ /* A global variable */ double Foo = 3.0; +void print_Foo() { + printf("In C, Foo = %f\n",Foo); +} + /* Compute the greatest common divisor of positive integers */ int gcd(int x, int y) { int g; diff --git a/SWIG/Examples/php4/simple/example.i b/SWIG/Examples/php4/simple/example.i index 55e1d46a2..af4ff08a7 100644 --- a/SWIG/Examples/php4/simple/example.i +++ b/SWIG/Examples/php4/simple/example.i @@ -2,7 +2,9 @@ %module example %{ -extern double Foo; + extern double Foo; %} +extern double Foo; +void print_Foo(); int gcd(int x, int y); diff --git a/SWIG/Examples/php4/simple/runme.php4 b/SWIG/Examples/php4/simple/runme.php4 index 9b9f32849..0e96fe800 100755 --- a/SWIG/Examples/php4/simple/runme.php4 +++ b/SWIG/Examples/php4/simple/runme.php4 @@ -12,13 +12,14 @@ print "The gcd of $x and $y is $g\n"; # Manipulate the Foo global variable # Output its current value -print "Foo = " . $Foo . "\n"; +print "Foo = " . Foo_get() . "\n"; # Change its value -$Foo = 3.1415926; +Foo_set(3.1415926); # See if the change took effect ( this isn't a good example for php, see # manual for why. ) -print "Foo = " . $Foo . "\n"; +print "Foo = " . Foo_get() . "\n"; +print_Foo(); ?>