summaryrefslogtreecommitdiff
path: root/include/visibility.h
diff options
context:
space:
mode:
authorMartijn Otto <martijn.otto@copernica.com>2015-03-26 16:00:10 +0100
committerMartijn Otto <martijn.otto@copernica.com>2015-03-26 16:00:10 +0100
commit7a928e2b19bddf152fd838469cc50805d4132401 (patch)
tree0a6657f4b94c27556b2f218e407f752018540d3b /include/visibility.h
parentae4fa5f871d937773e9facde87a32784e715e3ae (diff)
Changed default visibility for symbols in the PHP-CPP library to hidden and explicitly exported all symbols available from the public API. Moved the hiddenpointer to the zend implementation directory as it is not meant to be used publicly and not referenced anywhere from the API anyway
Diffstat (limited to 'include/visibility.h')
-rw-r--r--include/visibility.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/visibility.h b/include/visibility.h
new file mode 100644
index 0000000..afb8a6b
--- /dev/null
+++ b/include/visibility.h
@@ -0,0 +1,30 @@
+/**
+ * visibility.h
+ *
+ * This file defines macros used to define whether a symbol
+ * should be exported. It is only used for classes and
+ * functions that are defined in the public API to reduce
+ * the size of the symbol table, make linking and loading
+ * of the PHP-CPP library faster and generate more
+ * optimized code as a result.
+ *
+ * @copyright 2015 Copernica B.V.
+ */
+
+#if defined _WIN32 || defined __CYGWIN__
+ #ifdef BUILDING_PHPCPP
+ #ifdef __GNUC__
+ #define PHPCPP_EXPORT __attribute__ ((dllexport))
+ #else
+ #define PHPCPP_EXPORT __declspec(dllexport) // Note: actually gcc seems to also supports this syntax.
+ #endif
+ #else
+ #ifdef __GNUC__
+ #define DLL_EXPORT __attribute__ ((dllimport))
+ #else
+ #define DLL_EXPORT __declspec(dllimport) // Note: actually gcc seems to also supports this syntax.
+ #endif
+ #endif
+#else
+ #define PHPCPP_EXPORT __attribute__ ((visibility ("default")))
+#endif