Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27888 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33502 invoked by uid 1010); 7 Feb 2007 18:55:04 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 33487 invoked from network); 7 Feb 2007 18:55:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Feb 2007 18:55:04 -0000 Authentication-Results: pb1.pair.com header.from=cem@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=cem@php.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain php.net from 195.212.29.138 cause and error) X-PHP-List-Original-Sender: cem@php.net X-Host-Fingerprint: 195.212.29.138 mtagate5.uk.ibm.com Linux 2.0.3x (2) Received: from [195.212.29.138] ([195.212.29.138:38962] helo=mtagate5.uk.ibm.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DA/1A-18288-3802AC54 for ; Wed, 07 Feb 2007 13:55:00 -0500 Received: from d06nrmr1407.portsmouth.uk.ibm.com (d06nrmr1407.portsmouth.uk.ibm.com [9.149.38.185]) by mtagate5.uk.ibm.com (8.13.8/8.13.8) with ESMTP id l17Isum9187508 for ; Wed, 7 Feb 2007 18:54:56 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1407.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v8.2) with ESMTP id l17Isut31913004 for ; Wed, 7 Feb 2007 18:54:56 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l17IsuXo028073 for ; Wed, 7 Feb 2007 18:54:56 GMT Received: from mail-gw3.hursley.ibm.com (mail-gw3.hursley.ibm.com [9.20.131.251]) by d06av02.portsmouth.uk.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id l17IsuP3028069; Wed, 7 Feb 2007 18:54:56 GMT Received: from [9.20.118.16] (helo=bf1v5-118.hursley.ibm.com) by mail-gw3.hursley.ibm.com with esmtp (Exim 4.50) id 1HErwW-00074w-CC; Wed, 07 Feb 2007 18:54:56 +0000 Received: from [127.0.0.1] (sig-9-145-123-119.uk.ibm.com [9.145.123.119]) by bf1v5-118.hursley.ibm.com (AIX5.3/8.11.6p2/8.11.0) with ESMTP id l17IrqB1573000; Wed, 7 Feb 2007 18:53:53 GMT Message-ID: <45CA2032.2010205@php.net> Date: Wed, 07 Feb 2007 18:53:38 +0000 User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: Antony Dovgal CC: internals@lists.php.net References: <45C9B71C.4030806@zend.com> In-Reply-To: <45C9B71C.4030806@zend.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] C++ in non-threaded PHP From: cem@php.net (Caroline Maynard) 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)