Re: C++ in non-threaded PHP
| From: | Caroline Maynard | Date: | Wed, 07 Feb 2007 18:53:38 +0000 |
| Subject: | Re: C++ in non-threaded PHP | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-27888@lists.php.net to get a copy of this message | ||
Antony Dovgal wrote:
On 01/23/2007 06:07 PM, Caroline Maynard wrote:I think it's almost certain that they do - I just didn't have a test for them, so I used the "if it ain't broke don't fix it" principle.I hit some problems compiling a C++ extension in a non-threaded environment, because of some missing extern "C" declarations. Looks like this was previously fixed for threaded mode only. Please would someone with karma apply the following patch?What about ini_scanner_globals & language_scanner_globals? Don't they require the same declaration?
Also, how to reproduce it? I compile C++ extensions quite often and do not see any problems.Well you need to have an extension which references CG() or EG() from C++ and build it with --disable-zts. So, compiling the sdo extension, which refers to, for example, EG(uninitialized_zval_ptr), the link step gives: SDO_DataObject.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) struct _zend_executor_globals executor_globals" (__imp_?executor_globals@@3U_zend_executor_globals@@A) Debug\php_sdo.dll : fatal error LNK1120: 1 unresolved externals because the references are getting mangled. Putting them inside extern "C" fixes this. (my example was obviously on Windows, but the same should apply on *IX)