coming PHP 5.3 and gcc 4 visibility patch
| From: | Nuno Lopes | Date: | Sun, 24 Feb 2008 23:14:50 +0000 |
| Subject: | coming PHP 5.3 and gcc 4 visibility patch | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-5130@lists.php.net to get a copy of this message | ||
Hi,
As some of you may know, PHP 5.3 now supports GCC 4 -fvisibility switch (http://news.php.net/php.cvs/48158). This feature allows better code generation (especially when using -fPIC) and smaller binary sizes.
As a con, some extensions (those which export some sort of API) need some updating, as only core extensions were updated so far. So if your extension exports some function (usually by defining a EXTNAMEAPI macro in the php_extname.h file), you may want to update the macro definition to detect GCC 4.
e.g.:
#if windows
...
#elif defined(__GNUC__) && __GNUC__ >= 4
# define EXTNAMEAPI __attribute__ ((visibility("default")))
#else
# define EXTNAMEAPI
#endif
If you have any question, please ask me.
Nuno