diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-08-31 15:41:04 -0700 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-08-31 15:41:04 -0700 |
commit | d762ee103bee45bcd18df457c2c7a9f36991c75f (patch) | |
tree | bd8937a36a205a8755ac485c4ede65c10078b375 /tests | |
parent | 708e9cf9da9571a38ac8d2529d016cd78ce8ec54 (diff) |
Work in progress on a simpler api
Diffstat (limited to 'tests')
-rw-r--r-- | tests/simple/simple.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/tests/simple/simple.cpp b/tests/simple/simple.cpp index 761c7a0..b0259ca 100644 --- a/tests/simple/simple.cpp +++ b/tests/simple/simple.cpp @@ -15,6 +15,33 @@ */ using namespace std; +static int my_plus(int a, int b) +{ + return a + b; +} + +static std::string my_concat(std::string &a, std::string &b) +{ + return a + b; +} + +Function f({"my_plus", my_plus}); + + +// symbols are exported according to the "C" language +extern "C" +{ + // export the "get_module" function that will be called by the Zend engine + PHPCPP_EXPORT void *get_module() + { + // create extension + static PhpCpp::Extension extension("simple","1.0", { + {"my_plus", my_plus}, + {"my_concat", my_concat} + }); + + // return the module entry + return extension.getEntry(); + } +} -// create the object for the PHP extension -PHP_CPP_EXTENSION(Extension("simple","1.0")); |