From 902d86acbe01b0368771eb57873e09f2cfcd8184 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Wed, 5 Mar 2014 12:13:54 +0100 Subject: default empty extension added, optimized Makefile --- Examples/EmptyExtension/main.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Examples/EmptyExtension/main.cpp (limited to 'Examples/EmptyExtension/main.cpp') diff --git a/Examples/EmptyExtension/main.cpp b/Examples/EmptyExtension/main.cpp new file mode 100644 index 0000000..22aba90 --- /dev/null +++ b/Examples/EmptyExtension/main.cpp @@ -0,0 +1,26 @@ +#include + +/** + * tell the compiler that the get_module is a pure C function + */ +extern "C" { + + /** + * Function that is called by PHP right after the PHP process + * has started, and that returns an address of an internal PHP + * strucure with all the details and features of your extension + * + * @return void* a pointer to an address that is understood by PHP + */ + PHPCPP_EXPORT void *get_module() + { + // static(!) Php::Extension object that should stay in memory + // for the entire duration of the process (that's why it's static) + static Php::Extension myExtension("my_extension", "1.0"); + + // @todo add your own functions, classes, namespaces to the extension + + // return the extension + return myExtension; + } +} -- cgit v1.2.3