Antony Dovgal wrote:
> On 01/23/2007 06:07 PM, Caroline Maynard wrote:
>> 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?
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.
>
> 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)