|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-07-14 07:16 UTC] thomas at koch dot ro
Description:
------------
I try the most simple program that uses the embed sapi. Due to missing SAPI_API macros the symbols
int php_embed_init(int argc, char **argv PTSRMLS_DC);
void php_embed_shutdown(TSRMLS_D);
extern sapi_module_struct php_embed_module;
get visibility hidden in the resulting libphp5.so.
Fix: put SAPI_API before these symbols in sapi/embed/php_embed.c.
(Also in php_embed.h ?)
Thanks to ScottMac for the hint on IRC!
Reproduce code:
---------------
#include <sapi/embed/php_embed.h>
int main(int argc, char *argv[])
{
PHP_EMBED_START_BLOCK(argc,argv)
PHP_EMBED_END_BLOCK()
return 0;
}
Expected result:
----------------
should compile without problems
Actual result:
--------------
gcc -c -I/usr/local/include/php/ -I/usr/local/include/php/main -
I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -Wall -g -o
worker.o worker.c
gcc -L/usr/local/lib -lphp5 -o worker worker.o
worker.o: In function `main':
/var/checkouts/gearman-php-worker/worker.c:5: undefined reference to
`php_embed_init'
/var/checkouts/gearman-php-worker/worker.c:6: undefined reference to
`php_embed_shutdown'
collect2: ld returned 1 exit status
make: *** [all] Error
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 02:00:01 2025 UTC |
This patch breaks building php5embed on Windows. On Windows, php5embed is built as a static library, and doesn?t need these functions to be marked as SAPI_API. Can I suggest we instead use "EMBED_SAPI_API"? ----- #ifndef PHP_WIN32 #define EMBED_SAPI_API SAPI_API #else #define EMBED_SAPI_API #endif BEGIN_EXTERN_C() EMBED_SAPI_API int php_embed_init(int argc, char **argv PTSRMLS_DC); EMBED_SAPI_API void php_embed_shutdown(TSRMLS_D); extern EMBED_SAPI_API sapi_module_struct php_embed_module; END_EXTERN_C()