summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-09-08 16:26:11 -0700
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-09-08 16:26:11 -0700
commitdf2520e4b2c87e2302ee4c6cec1e672091efebfb (patch)
treef3bcd4fa7c4d0c6ee601268ceca4d6841ed90d0d /tests
parenteb86ac350756afeffa0e2db8be87876d35bc40a8 (diff)
Refactoring function class, and making it even more easy to directly enable native C functions in PHP
Diffstat (limited to 'tests')
-rw-r--r--tests/simple/simple.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/tests/simple/simple.cpp b/tests/simple/simple.cpp
index b0259ca..a33b220 100644
--- a/tests/simple/simple.cpp
+++ b/tests/simple/simple.cpp
@@ -25,8 +25,11 @@ static std::string my_concat(std::string &a, std::string &b)
return a + b;
}
-Function f({"my_plus", my_plus});
-
+class MyCustomFunction : public Php::Function
+{
+
+
+};
// symbols are exported according to the "C" language
extern "C"
@@ -34,14 +37,25 @@ extern "C"
// export the "get_module" function that will be called by the Zend engine
PHPCPP_EXPORT void *get_module()
{
+ cout << "a" << endl;
+
// create extension
- static PhpCpp::Extension extension("simple","1.0", {
- {"my_plus", my_plus},
- {"my_concat", my_concat}
- });
+ static Php::Extension extension("simple","1.0");
+
+ cout << "b" << endl;
+
+ // define the functions
+// extension.add("my_plus", my_plus);
+// extension.add("my_concat", my_concat);
+ extension.add("my_custom", MyCustomFunction());
+
+ cout << "c" << endl;
+
+ // define classes
+// extension.add("my_class", MyCustomClass());
// return the module entry
- return extension.getEntry();
+ return extension.module();
}
}