Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73519 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50244 invoked from network); 2 Apr 2014 13:56:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Apr 2014 13:56:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=oneil@saxonica.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=oneil@saxonica.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain saxonica.com from 217.69.47.236 cause and error) X-PHP-List-Original-Sender: oneil@saxonica.com X-Host-Fingerprint: 217.69.47.236 uk1rly2283.eechost.net Linux 2.6 Received: from [217.69.47.236] ([217.69.47.236:54980] helo=uk1rly2283.eechost.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 87/B0-46235-6071C335 for ; Wed, 02 Apr 2014 08:56:23 -0500 Received: from [82.152.109.199] (helo=[192.168.0.112]) by uk1rly2283.eechost.net with esmtpa (Exim 4.72) (envelope-from ) id 1WVLfU-0004SJ-AK; Wed, 02 Apr 2014 14:57:28 +0100 Content-Type: multipart/alternative; boundary="Apple-Mail=_3ED5514F-0745-4FD0-AA98-BDC57C26CA05" Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) In-Reply-To: <1396445137.2982.291.camel@guybrush> Date: Wed, 2 Apr 2014 14:56:18 +0100 Cc: internals@lists.php.net Message-ID: <2EF10AD3-FC2C-4F34-9639-8BC798DB0917@saxonica.com> References: <42E6A56D-0FF1-4408-BCF5-DFBCEDA735EB@saxonica.com> <1396445137.2982.291.camel@guybrush> To: =?iso-8859-1?Q?Johannes_Schl=FCter?= X-Mailer: Apple Mail (2.1874) X-Auth-Info: oneil@saxonica.com (plain) Subject: Re: [PHP-DEV] PHP C++ extension on Windows: setting the working directory the same as PHP From: oneil@saxonica.com (O'Neil Delpratt) --Apple-Mail=_3ED5514F-0745-4FD0-AA98-BDC57C26CA05 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On 2 Apr 2014, at 14:25, Johannes Schl=FCter = wrote: > On Wed, 2014-04-02 at 14:14 +0100, O'Neil Delpratt wrote: >> Hi, >>=20 >> I am having trouble getting the correct working directory in the = C/C++ >> code of my PHP extension. It should be the same as the PHP working >> directory, but it is not. > [...] >> In linux the C function getcwd() does as expected. It is the same as >> the PHP cwd, but on windows it always uses the =93C:\Program Files >> \Apache software Foundation\Apache2.2=94, >> whereas in my php script the call =91echo getcwd();=92 returns = =93C:\www >> \html=94 as expected. >=20 > when using Apache on Windows you are using mod_mpm which is a threaded > environment. Thus there is one process which might serve multiple > requests in different threads. Each thread needs (from user = perspective) > its own working directory, thus our thread isolation library, TSRM, > provides an API for that: VCWD_GETCWD. Please see > TSRM/tsrm_virtual_cwd.h for more related APIs. Mind: In 5.6 this has > been moved to Zend/zend_virtual_cwd.h Thanks for your quick response. When I compile my code I am now getting the following error: Error 93 error LNK2001: unresolved external symbol = "__declspec(dllimport) char * __cdecl virtual_getcwd(char *,unsigned = int,void * * *)" (__imp_?virtual_getcwd@@YAPADPADIPAPAPAX@Z) = C:\Users\ond1\Documents\Visual Studio = 2012\Projects\saxon\saxon\SaxonProcessor.obj insertions in my C Code: #include =93TSRM/tsrm_virtual_cwd.h=94 =85. char cwd[256]; VCWD_GETCWD(cwd, sizeof(cwd)); ...=20 Any ideas? ------------------------------- O'Neil Delpratt Software Developer, Saxonica Limited Email: oneil@saxonica.com Tel: +44 118 946 5894 Web: http://www.saxonica.com Saxonica Community site: http://dev.saxonica.com Bug tracking site: https://saxonica.plan.io/ --Apple-Mail=_3ED5514F-0745-4FD0-AA98-BDC57C26CA05--