Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73697 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15953 invoked from network); 15 Apr 2014 11:09:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Apr 2014 11:09:13 -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.40.69 cause and error) X-PHP-List-Original-Sender: oneil@saxonica.com X-Host-Fingerprint: 217.69.40.69 relay01.mail.uk1.eechost.net Linux 2.6 Received: from [217.69.40.69] ([217.69.40.69:33668] helo=uk1rly2283.eechost.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5A/82-27880-5531D435 for ; Tue, 15 Apr 2014 07:09:11 -0400 Received: from [82.152.109.199] (helo=[192.168.0.112]) by uk1rly2283.eechost.net with esmtpa (Exim 4.72) (envelope-from ) id 1Wa1G3-0008Ox-Bu; Tue, 15 Apr 2014 12:10:31 +0100 Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) In-Reply-To: <92562119-D2D8-4FA2-B5AF-43D676B8E0C0@saxonica.com> Date: Tue, 15 Apr 2014 12:09:01 +0100 Cc: Anatol Belski , internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: References: <42E6A56D-0FF1-4408-BCF5-DFBCEDA735EB@saxonica.com> <1396445137.2982.291.camel@guybrush> <2EF10AD3-FC2C-4F34-9639-8BC798DB0917@saxonica.com> <1396449767.2982.294.camel@guybrush> <40B86AC1-3057-4016-95E2-EB8E754A70E1@saxonica.com> <57711604dc923c34412021350230d52e.squirrel@webmail.klapt.com> <92562119-D2D8-4FA2-B5AF-43D676B8E0C0@saxonica.com> To: O'Neil Delpratt 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) Dear all, After much struggle I am still getting the following error on windows = when I build php with our extension that uses VC_GETCWD: 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\php_saxon.obj saxon Looking more closely at the linker error it seems that the = virtual_getcwd cannot be found where the last argument is void ***. In TSRM/tsrm_virtual_cwd.h we have the following: #ifdef VIRTUAL_DIR #define VCWD_GETCWD(buff, size) virtual_getcwd(buff, size TSRMLS_CC) =85. The definition of virtual_getcwd further down in TSRM/tsrm_virtual_cwd.h = is as follows. Notice that it uses TSRMLS_DC: CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC); I notice the use of the macro TSRMLS_CC. In TSRM.h we have following: #define TSRMLS_D void ***tsrm_ls #define TSRMLS_DC , TSRMLS_D #define TSRMLS_C tsrm_ls #define TSRMLS_CC , TSRMLS_C It seems that the right macro is not been used or picked up. Any ideas? Thanks and kind regards, O'Neil On 3 Apr 2014, at 13:39, O'Neil Delpratt wrote: > Thanks very much for your help. I will let you know how it goes > On 3 Apr 2014, at 12:55, Anatol Belski wrote: >=20 >> Yes, first of all you need to extern "C" all the PHP headers, as they = are >> all C. The php.h is needed on any platform. Then the header include = order >> seems odd, please take a look at the following: >>=20 >> = http://svn.php.net/viewvc/pecl/xmldiff/trunk/php_xmldiff.h?view=3Dmarkup >> = http://svn.php.net/viewvc/pecl/ktaglib/trunk/php_ktaglib.h?view=3Dmarkup >>=20 >> those are the headers of some C++ extensions. Also it might be = interesting >> for you to look at their config.w32 . >>=20 >> With the VCWD_GETCWD usage - that's only what you need. It's not = necessary >> to use GetCurrentDirectory or getcwd, VCWD_GETCWD will do the job and = care >> about TS/NTS portable way. >>=20 >> Please also take a look at this wiki page >> https://wiki.php.net/internals/review_comments with some useful = hints, >> like that there should be no PHP_FUNCTION definitions in php_myext.h = but >> rather in the .cpp file. >>=20 >> Regards >>=20 >> Anatol >=20 > ------------------------------- > 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/ >=20 >=20 >=20 ------------------------------- 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/