diff options
author | JasperVanEck <jaspergkurtz@gmail.com> | 2013-12-02 17:09:59 +0100 |
---|---|---|
committer | JasperVanEck <jaspergkurtz@gmail.com> | 2013-12-02 17:09:59 +0100 |
commit | 3750e24683f3a1d0b643e9808d9619db40d31cc4 (patch) | |
tree | fd6a2c60a0ff95460d73f0004ef2d4e12556e57a /Examples/simple | |
parent | 9bb110fe1b7d9684d0af6bdd208b02a04c2a7392 (diff) |
Added CppClassInPhp Example
Diffstat (limited to 'Examples/simple')
-rw-r--r-- | Examples/simple/30-phpcpp.ini | 4 | ||||
-rw-r--r-- | Examples/simple/Makefile | 2 | ||||
-rw-r--r-- | Examples/simple/simple.cpp | 17 |
3 files changed, 7 insertions, 16 deletions
diff --git a/Examples/simple/30-phpcpp.ini b/Examples/simple/30-phpcpp.ini new file mode 100644 index 0000000..f366951 --- /dev/null +++ b/Examples/simple/30-phpcpp.ini @@ -0,0 +1,4 @@ +; configuration for phpcpp module +; priority=30 +extension=simple.so + diff --git a/Examples/simple/Makefile b/Examples/simple/Makefile index 6e3ecea..cfea8cf 100644 --- a/Examples/simple/Makefile +++ b/Examples/simple/Makefile @@ -9,7 +9,7 @@ PHP_CONFIG_DIR = /etc/php5/cli/conf.d LD = g++ LD_FLAGS = -Wall -shared -O2 -RESULT = functionnoparameters.so +RESULT = simple.so PHPINIFILE = 30-phpcpp.ini diff --git a/Examples/simple/simple.cpp b/Examples/simple/simple.cpp index 7dc9305..3a93bdc 100644 --- a/Examples/simple/simple.cpp +++ b/Examples/simple/simple.cpp @@ -74,17 +74,6 @@ Php::Value bubblesort(Php::Parameters ¶ms) } -void my_function() -{ - -} - -Php::Value my_integer_return() -{ - throw Php::Exception("er is iets mis"); - - return "abcd"; -} /** * Our own "my_plus" function that will be available in PHP @@ -173,7 +162,7 @@ extern "C" // define the functions extension.add("my_plus", my_plus, { Php::ByVal("a", Php::numericType), - Php::ByVal("b", Php::numericType) + Php::ByVal("b", Php::numericType), Php::ByVal("c", "MyClass"), Php::ByRef("d", Php::stringType) }); @@ -184,9 +173,7 @@ extern "C" // define classes extension.add("my_class", Php::Class<MyCustomClass>({ - Php::Public("a", 123), - Php::Protected("b", "abc"), - Php::Protected("myMethod", Php::Method<MyCustomClass>(&MyCustomClass::myMethod)), + Php::Public("myMethod", Php::Method<MyCustomClass>(&MyCustomClass::myMethod)), Php::Public("__construct", Php::Method<MyCustomClass>(&MyCustomClass::__construct)) })); |