diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-05 12:13:54 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-05 12:13:54 +0100 |
commit | 902d86acbe01b0368771eb57873e09f2cfcd8184 (patch) | |
tree | 915525263b9c6ecf7aebaffcd46e5a82f735f37d /Examples/EmptyExtension/main.cpp | |
parent | ed200cc18fb5fea88b8e9e2ff730af6cf1d50663 (diff) |
default empty extension added, optimized Makefile
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; + } +} |