#39522 [Opn->Fbk]: PHP's header files are unusable for C++ extensions

From: Date: Wed, 15 Nov 2006 09:46:17 +0000
Subject: #39522 [Opn->Fbk]: PHP's header files are unusable for C++ extensions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-105000@lists.php.net to get a copy of this message
ID: 39522 Updated by: tony2001@php.net Reported By: phoemix at harmless dot hu -Status: Open +Status: Feedback Bug Type: Compile Failure Operating System: freebsd6, linux (but irrelevant) PHP Version: 5.2.0 New Comment: We have several C++ extensions in PECL and I'm happen to be the author of one. And I didn't/don't see any problems with C++ and PHP headers, even on FreeBSD. Please elaborate and show what exactly is wrong before posting a patch for a bug which is not reproducible. Previous Comments: ------------------------------------------------------------------------ [2006-11-15 07:35:47] phoemix at harmless dot hu Description: ------------ (the php version is irrelevant, i just couldn't pick that for the "compile failure" type. i had it on 4.x and on 5.x both" create a new extensions, have a C++ source file, and include some php headers. it will fail on two points. 1) C++ doesn't support "long long". lot's of architectures has stdint.h (i think it's C99). that should be used instead of "long long"-ing manually. 2) C++ prohobits havint a trailing coma at the end of an enum's last member. i have created a patch for the FreeBSD ports system. the errors are in snprintf.h and in php_stream_filter_api.h/. --- patch follows --- diff -ur php-5.2.0-orig/main/snprintf.h php-5.2.0/main/snprintf.h --- php-5.2.0-orig/main/snprintf.h Sun Jan 1 13:50:17 2006 +++ php-5.2.0/main/snprintf.h Tue Nov 14 14:23:31 2006 @@ -120,8 +120,14 @@ #else # define WIDE_INT long #endif +#ifdef __FreeBSD__ +#include <stdint.h> +typedef int64_t wide_int; +typedef uint64_t u_wide_int; +#else typedef WIDE_INT wide_int; typedef unsigned WIDE_INT u_wide_int; +#endif typedef int bool_int; diff -ur php-5.2.0-orig/main/streams/php_stream_filter_api.h php-5.2.0/main/streams/php_stream_filter_api.h --- php-5.2.0-orig/main/streams/php_stream_filter_api.h Sun Jan 1 13:50:18 2006 +++ php-5.2.0/main/streams/php_stream_filter_api.h Tue Nov 14 14:24:33 2006 @@ -62,7 +62,7 @@ typedef enum { PSFS_ERR_FATAL, /* error in data stream */ PSFS_FEED_ME, /* filter needs more data; stop processing chain until more is available */ - PSFS_PASS_ON, /* filter generated output buckets; pass them on to next in chain */ + PSFS_PASS_ON /* filter generated output buckets; pass them on to next in chain */ } php_stream_filter_status_t; /* Buckets API. */ Reproduce code: --------------- create a new extensions, have a C++ source file, and include some php headers. it will fail on two points. Expected result: ---------------- a clean compilation. Actual result: -------------- i don't have the error output yet, since my local version is fixed manually. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39522&edit=1

« previous php.bugs (#105000) next »