diff options
Diffstat (limited to 'Examples/EmptyExtension/main.cpp')
-rw-r--r-- | Examples/EmptyExtension/main.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
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 <phpcpp.h> + +/** + * 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; + } +} |