summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-01-20 13:45:17 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-01-20 13:45:17 +0100
commit5235f87126cc2bca3907daada9f59e0c7c7bc834 (patch)
tree6b049edd2eca0b74a8acb9ff7ee0c84c93bf1a5c /include
parent821e65d876cc0ce2b32471791b02d9f7cc784c99 (diff)
PHP-CPP now checks whether an already compiled extension is still compatible with the PHP-CPP library. This prevents weird crashes when users update their PHP-CPP library, without recompiling their extensions
Diffstat (limited to 'include')
-rw-r--r--include/extension.h11
-rw-r--r--include/version.h17
2 files changed, 27 insertions, 1 deletions
diff --git a/include/extension.h b/include/extension.h
index 562fceb..15ad5e1 100644
--- a/include/extension.h
+++ b/include/extension.h
@@ -38,10 +38,19 @@ class Extension : public Namespace
public:
/**
* Constructor that defines a number of functions right away
+ *
+ * The first two parameters should be filled by the extension programmer with the
+ * name of the extension, and the version number of the extension (like "1.0").
+ * The third parameter, apiversion, does not have to be supplied and is best kept
+ * to the default value. This third parameter checks whether the PHP-CPP version
+ * that is currently installed on the server is the same as the PHP-CPP version
+ * that was used to compile the extension with.
+ *
* @param name Extension name
* @param version Extension version string
+ * @param apiversion PHP API version (this should always be PHPCPP_API_VERSION, so you better not supply it)
*/
- Extension(const char *name, const char *version = "1.0");
+ Extension(const char *name, const char *version = "1.0", int apiversion = PHPCPP_API_VERSION);
/**
* No copy'ing and no moving
diff --git a/include/version.h b/include/version.h
new file mode 100644
index 0000000..85d2b66
--- /dev/null
+++ b/include/version.h
@@ -0,0 +1,17 @@
+/**
+ * Version.h
+ *
+ * Macro with API version. The API version number prevents that
+ * extensions are loaded that are incompatible with the libphpcpp.so
+ * library
+ *
+ * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
+ * @copyright 2015 Copernica BV
+ */
+
+/**
+ * Macro with version number (this is incremented with every release)
+ */
+#define PHPCPP_API_VERSION 20150120
+
+