From ae07ef4cf606147c77b6ba472956e2793e251ba6 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Thu, 5 Feb 2015 11:20:25 +0100 Subject: for 32bit systems there was a compile issue, hopefully this commit solves that (issue 167) --- include/platform.h | 27 +++++++++++++++++++++++++++ phpcpp.h | 1 + zend/constantimpl.h | 5 +++++ zend/includes.h | 1 + 4 files changed, 34 insertions(+) create mode 100644 include/platform.h diff --git a/include/platform.h b/include/platform.h new file mode 100644 index 0000000..561cd60 --- /dev/null +++ b/include/platform.h @@ -0,0 +1,27 @@ +/** + * Platform.h + * + * Macro that we use to find out whether we run on 64bit or 32bit + * platforms. + * + * @author Emiel Bruijntjes + * @copyright 2015 Copernica BV + */ + +// Check windows +#if _WIN32 || _WIN64 +#if _WIN64 +#define PHPCPP_64BIT +#else +#define PHPCPP_32BIT +#endif +#endif + +// Check GCC and clang +#if __GNUC__ || __clang__ +#if __x86_64__ || __ppc64__ +#define PHPCPP_64BIT +#else +#define PHPCPP_32BIT +#endif +#endif diff --git a/phpcpp.h b/phpcpp.h index 0b0beb0..16c1690 100644 --- a/phpcpp.h +++ b/phpcpp.h @@ -28,6 +28,7 @@ * Include all headers files that are related to this library */ #include +#include #include #include #include diff --git a/zend/constantimpl.h b/zend/constantimpl.h index 7320a8b..1fb1676 100644 --- a/zend/constantimpl.h +++ b/zend/constantimpl.h @@ -127,8 +127,13 @@ public: break; case IS_LONG: +#ifdef PHPCPP_32BIT + // 32bit systems find this difficult + clss.property(_name, (int32_t)Z_LVAL(_constant.value), Php::Const); +#else // set a long constant clss.property(_name, Z_LVAL(_constant.value), Php::Const); +#endif break; case IS_DOUBLE: diff --git a/zend/includes.h b/zend/includes.h index 31d3963..97cacc9 100644 --- a/zend/includes.h +++ b/zend/includes.h @@ -47,6 +47,7 @@ * Include other files from this library */ #include "../include/noexcept.h" +#include "../include/platform.h" #include "../include/version.h" #include "../include/inivalue.h" #include "../include/ini.h" -- cgit v1.2.3