Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38080 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87202 invoked from network); 2 Jun 2008 10:40:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jun 2008 10:40:42 -0000 Authentication-Results: pb1.pair.com smtp.mail=tony@daylessday.org; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tony@daylessday.org; sender-id=pass Received-SPF: pass (pb1.pair.com: domain daylessday.org designates 89.208.40.236 as permitted sender) X-PHP-List-Original-Sender: tony@daylessday.org X-Host-Fingerprint: 89.208.40.236 mail.daylessday.org Linux 2.6 Received: from [89.208.40.236] ([89.208.40.236:49785] helo=daylessday.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FF/A1-12632-A2EC3484 for ; Mon, 02 Jun 2008 06:40:42 -0400 Received: from [192.168.3.91] (unknown [212.42.62.198]) by daylessday.org (Postfix) with ESMTP id 34C966400BD; Mon, 2 Jun 2008 14:40:39 +0400 (MSD) Message-ID: <4843CE26.40902@daylessday.org> Date: Mon, 02 Jun 2008 14:40:38 +0400 User-Agent: Thunderbird 2.0.0.12 (X11/20080226) MIME-Version: 1.0 To: Adam Klobukowski CC: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Global structures in extension From: tony@daylessday.org (Antony Dovgal) On 02.06.2008 13:35, Adam Klobukowski wrote: > Hello > > I'm writing a PHP extension where I'm using a custom library. This > library uses a structure that needs to be initialized once per server > instance. First I initialized it in each of my functions and > deinitialize it ant the end. It works ok, but unfortunetly it turns to > be to slow. So, I'm trying to do it globally. Everything in that library > is internally synchronized, so I don not have to worry about thread > safety. I declare my structure globally (in fact a pointer to a > structure), initialize it in PHP_MINIT (it works), then deinitialize in > PHP_MSHUTDOWN (works too). That's exactly what lots of extensions do. > Unfortunetly, when I'm trying to use this > structure in my PHP_FUNCTIONs, it does not work. You've managed to describe everything except for the problem itself =) What does this "does not work" mean? How exactly do you initialize and address these variables? > Btw. I'm looking for a good reference of internal PHP APIs. I found > excelent Sara's Golemon articles, but thats all, is there anything better? The sources are better. -- Wbr, Antony Dovgal