# PHP C++ extension on Windows: setting the working directory the same as PHP

- Thread: https://externals.io/message/73517
- Original archive: https://news-web.php.net/php.internals/73517
- Started by O'Neil Delpratt on 2014-04-02T13:14:54+00:00
- Messages: 23
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #73517 — O'Neil Delpratt — 2014-04-02T13:14:54+00:00

URL: https://externals.io/message/73517#73517

Hi,

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.

I have tried looking this on the web, but with not much joy. I found a blog which describes my problem:

https://www.ibm.com/developerworks/community/blogs/phpblog/entry/comparing_windows_and_php_working?lang=en

In linux the C function `getcwd()` does as expected. It is the same as the PHP cwd, but on windows it always uses the “C:\Program Files\Apache software Foundation\Apache2.2”,
whereas in my php script the call ‘echo `getcwd()`;’ returns “C:\www\html” as expected.

Please may someone point me in the write direction of how to get to the PHP current working directory in a C/C++ PHP extension.

Thanks in advance,

-------------------------------
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/

---

## #73518 — johannes@schlueters.de — 2014-04-02T13:25:37+00:00

URL: https://externals.io/message/73517#73518 · In reply to: #73517

> Hi,
> 
> 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 “C:\Program Files
> \Apache software Foundation\Apache2.2”,
> whereas in my php script the call ‘echo `getcwd()`;’ returns “C:\www
> \html” as expected.

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

johannes

---

## #73519 — O'Neil Delpratt — 2014-04-02T13:56:18+00:00

URL: https://externals.io/message/73517#73519 · In reply to: #73518

> 
> > […]
> [...]
> > […]
> 
> 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 “TSRM/tsrm_virtual_cwd.h”

….
char cwd[256];

VCWD_GETCWD(cwd, sizeof(cwd));
... 


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/

---

## #73520 — johannes@schlueters.de — 2014-04-02T14:42:47+00:00

URL: https://externals.io/message/73517#73520 · In reply to: #73519

> 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:

The subject talks about C++, now C. If you are using C++: Probably that
header is missing extern "C" declarations? Try 

extern "C" {
#include "TSRM/tsrm_virtual_cwd.h"
}

johannes

---

## #73557 — O'Neil Delpratt — 2014-04-03T09:44:08+00:00

URL: https://externals.io/message/73517#73557 · In reply to: #73520

Just to report to the list that the linkage error has not gone away, even with the extern “C” wrapped around the include. 
It seems like I need to add some library dependency? But my experience of Windows and c++ is limited.




> 
> > […]
> 
> The subject talks about C++, now C. If you are using C++: Probably that
> header is missing extern "C" declarations? Try 
> 
> extern "C" {
> #include "TSRM/tsrm_virtual_cwd.h"
> }
> 
> johannes
> 
> 

-------------------------------
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/

---

## #73562 — Anatol Belski — 2014-04-03T10:47:42+00:00

URL: https://externals.io/message/73517#73562 · In reply to: #73557

Hi O'Neil,


> Just to report to the list that the linkage error has not gone away, even
> with the extern “C” wrapped around the include. It seems like I need to
> add some library dependency? But my experience of Windows and c++ is
> limited.
>
>
> On 2 Apr 2014, at 15:42, Johannes Schlüter <johannes@schlueters.de>
> wrote:
>
>
> > […]
>
> -------------------------------
> 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/
>
>
>
>
>
> --
> 
> 
>
>
>
do you have your code somewhere around, or at least could you share a
problem snippet?

Regards

Anatol

---

## #73564 — O'Neil Delpratt — 2014-04-03T11:15:22+00:00

URL: https://externals.io/message/73517#73564 · In reply to: #73562

Hi,

Please find the php_Saxon.h file attached. I am a beginner to the world of php extensions so you might spot things that I should not be doing. Any way the liens of code that you should focus are:

Line 29 (includes the required header)

Lines between 143 - 160

If you need the full project let me know. I have been using VC11. for the setup of the project I followed various tutorial guides such as:

http://www.dreamincode.net/forums/topic/244215-introduction-to-creating-a-php-extension-for-windows/

kind regards,

O'Neil

	



> Hi O'Neil,
> 
> 
> > […]
> do you have your code somewhere around, or at least could you share a
> problem snippet?
> 
> Regards
> 
> Anatol

-------------------------------
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/

---

## #73568 — Anatol Belski — 2014-04-03T11:55:36+00:00

URL: https://externals.io/message/73517#73568 · In reply to: #73564

Hi,


>

>
> Hi,
>
>
> Please find the php_Saxon.h file attached. I am a beginner to the world
> of php extensions so you might spot things that I should not be doing. Any
>  way the liens of code that you should focus are:
>
> Line 29 (includes the required header)
>
>
> Lines between 143 - 160
>
>
> If you need the full project let me know. I have been using VC11. for the
>  setup of the project I followed various tutorial guides such as:
>
> http://www.dreamincode.net/forums/topic/244215-introduction-to-creating-a
> -
> php-extension-for-windows/
>
> kind regards,
>
> O'Neil
>
>
>
>
> 
>
>
> > […]
> even
> > […]
> C:\Users
>
> > […]
> that
> > […]
>
> -------------------------------
> 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/
>
>
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:

http://svn.php.net/viewvc/pecl/xmldiff/trunk/php_xmldiff.h?view=markup
http://svn.php.net/viewvc/pecl/ktaglib/trunk/php_ktaglib.h?view=markup

those are the headers of some C++ extensions. Also it might be interesting
for you to look at their config.w32 .

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.

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.

Regards

Anatol

---

## #73570 — O'Neil Delpratt — 2014-04-03T12:39:54+00:00

URL: https://externals.io/message/73517#73570 · In reply to: #73568

Thanks very much for your help. I will let you know how it goes


> 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:
> 
> http://svn.php.net/viewvc/pecl/xmldiff/trunk/php_xmldiff.h?view=markup
> http://svn.php.net/viewvc/pecl/ktaglib/trunk/php_ktaglib.h?view=markup
> 
> those are the headers of some C++ extensions. Also it might be interesting
> for you to look at their config.w32 .
> 
> 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.
> 
> 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.
> 
> Regards
> 
> Anatol

-------------------------------
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/

---

## #73697 — O'Neil Delpratt — 2014-04-15T11:09:01+00:00

URL: https://externals.io/message/73517#73697 · In reply to: #73570

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)
….

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





> Thanks very much for your help. I will let you know how it goes
> 
> 
> > […]
> 
> -------------------------------
> 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/
> 
> 
> 

-------------------------------
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/

---

## #74086 — O'Neil Delpratt — 2014-05-09T09:20:55+00:00

URL: https://externals.io/message/73517#74086 · In reply to: #73568

Hi,

Is there a better way to build a PHP C++ extension for PHP 5.5 than in Visual studio? I know it can be done in the PHP build process for windows as described in the book “Extending and Embedding PHP” by Sara Golemon which I did try but failed with linking errors, maybe because of the config.w32 file not being setup properly. Under linux I have no issues.

kind regards,

O'Neil

---

## #74087 — Pierre Joye — 2014-05-09T09:26:53+00:00

URL: https://externals.io/message/73517#74087 · In reply to: #74086

hi,


> Hi,
>
> Is there a better way to build a PHP C++ extension for PHP 5.5 than in Visual studio? I know it can be done in the PHP build process for windows as described in the book “Extending and Embedding PHP” by Sara Golemon which I did try but failed with linking errors, maybe because of the config.w32 file not being setup properly. Under linux I have no issues.

Actually the better and recommended way is not to use VS but for debugging.

See https://wiki.php.net/internals/windows/stepbystepbuild

-- 
Pierre

@pierrejoye | http://www.libgd.org

---

## #74088 — O'Neil Delpratt — 2014-05-09T10:06:22+00:00

URL: https://externals.io/message/73517#74088 · In reply to: #74087

> hi,
> 
> 
> > […]
> 
> Actually the better and recommended way is not to use VS but for debugging.
> 
> See https://wiki.php.net/internals/windows/stepbystepbuild


How about building your own extension? There seems to be a lack of information about doing that on windows

> 
> -- 
> Pierre
> 
> @pierrejoye | http://www.libgd.org

-------------------------------
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/

---

## #74089 — Martin Keckeis — 2014-05-09T11:39:54+00:00

URL: https://externals.io/message/73517#74089 · In reply to: #74088

Hello together,

2014-05-09 12:06 GMT+02:00 O'Neil Delpratt <oneil@saxonica.com>:

>
> 
>
> > […]
> wrote:
> > […]
> Visual studio? I know it can be done in the PHP build process for windows
> as described in the book “Extending and Embedding PHP” by Sara Golemon
> which I did try but failed with linking errors, maybe because of the
> config.w32 file not being setup properly. Under linux I have no issues.
> > […]
> debugging.
> > […]
>
>
> How about building your own extension? There seems to be a lack of
> information about doing that on windows


I also try currently to port over this extension to windows:
https://github.com/piersharding/php-sapnwrfc/issues/6
My progress is not bad...i think there are some incompabilities left
between the versions.....but there are no error messages left at compile
...so its hard to figure out:-/

my resources:
https://wiki.php.net/internals/windows/stepbystepbuild
http://www.php.net/manual/en/internals2.buildsys.configwin.php
http://www.dreamincode.net/forums/topic/244215-introduction-to-creating-a-php-extension-for-windows/

the bad things
- there is no real documentation about config.w32 (i've gone through pecl
packages and ported my code from there
  - at least i didnt found one...
- what are the parameters for functions
like EXTENSION() CHECK_LIB() CHECK_HEADER_ADD_INCLUDE().....??
  - i guess them currently with the usage in the different pecl packages....
- what kind of functions are available in config.w32?
- the binarys-tools are from 2011...no vc11 folder is created.
http://windows.php.net/downloads/php-sdk/
- in the package i have some lib dependencies -> they must be in the
deps/bin folder
  - how can i change the source path? only with "--with-extra-libs" ?
  - there is the CHECK_LIB() function -> but why the lib is not taken from
there, instead of the deps/bin folder?

Thanks in advance.

Best regards
Martin

---

## #74090 — Pierre Joye — 2014-05-09T11:41:00+00:00

URL: https://externals.io/message/73517#74090 · In reply to: #74088

>
> 
>
> > […]
>
>
> How about building your own extension? There seems to be a lack of information about doing that on windows

same, copy it to the ../pecl/ directory, run buildconf etc.

You can use phpize too if your exts do not have dependencies against
other extension.

The process is also described in the wiki

Cheers,
-- 
Pierre

@pierrejoye | http://www.libgd.org

---

## #74091 — O'Neil Delpratt — 2014-05-09T11:46:18+00:00

URL: https://externals.io/message/73517#74091 · In reply to: #74090

Thanks for your help.




> 
> > […]
> 
> same, copy it to the ../pecl/ directory, run buildconf etc.
> 
> You can use phpize too if your exts do not have dependencies against
> other extension.
> 
> The process is also described in the wiki
> 
> Cheers,
> -- 
> Pierre
> 
> @pierrejoye | http://www.libgd.org

-------------------------------
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/

---

## #74092 — O'Neil Delpratt — 2014-05-09T11:46:59+00:00

URL: https://externals.io/message/73517#74092 · In reply to: #74089

Thanks. I will look at the details shortly.




> Hello together,
> 
> 2014-05-09 12:06 GMT+02:00 O'Neil Delpratt <oneil@saxonica.com>:
> 
> 
> 
> > […]
> 
> 
> How about building your own extension? There seems to be a lack of information about doing that on windows
> 
> I also try currently to port over this extension to windows: 
> https://github.com/piersharding/php-sapnwrfc/issues/6
> My progress is not bad...i think there are some incompabilities left between the versions.....but there are no error messages left at compile ...so its hard to figure out:-/
> 
> my resources:
> https://wiki.php.net/internals/windows/stepbystepbuild
> http://www.php.net/manual/en/internals2.buildsys.configwin.php
> http://www.dreamincode.net/forums/topic/244215-introduction-to-creating-a-php-extension-for-windows/
> 
> the bad things
> - there is no real documentation about config.w32 (i've gone through pecl packages and ported my code from there
>   - at least i didnt found one...
> - what are the parameters for functions like EXTENSION() CHECK_LIB() CHECK_HEADER_ADD_INCLUDE().....??
>   - i guess them currently with the usage in the different pecl packages....
> - what kind of functions are available in config.w32?
> - the binarys-tools are from 2011...no vc11 folder is created. http://windows.php.net/downloads/php-sdk/
> - in the package i have some lib dependencies -> they must be in the deps/bin folder
>   - how can i change the source path? only with "--with-extra-libs" ?
>   - there is the CHECK_LIB() function -> but why the lib is not taken from there, instead of the deps/bin folder?
> 
> 

-------------------------------
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/

---

## #74093 — Martin Keckeis — 2014-05-09T12:13:17+00:00

URL: https://externals.io/message/73517#74093 · In reply to: #74092

Hello together,

the compiled module is now loaded (2 functions work, which dont need the
dll extension from SAP) and its also shown in phpInfo....

But ASAP the extension is executed with dll dependency -> it crashes....

@Pierre
Is it a problem when the dlls are getting partly loaded from
C:\Windows\SysWOW64\...
See here the error report:
https://gist.github.com/ThaDafinser/e6380157c4f77a3286e5#file-report_crash-txt-L47-L96


Thanks in advance
Martin

---

## #74095 — Anatol Belski — 2014-05-09T13:38:01+00:00

URL: https://externals.io/message/73517#74095 · In reply to: #74093

Hi Martin,


> Hello together,
>
>
> the compiled module is now loaded (2 functions work, which dont need the
> dll extension from SAP) and its also shown in phpInfo....
>
> But ASAP the extension is executed with dll dependency -> it crashes....
>
>
> @Pierre
> Is it a problem when the dlls are getting partly loaded from
> C:\Windows\SysWOW64\...
> See here the error report:
> https://gist.github.com/ThaDafinser/e6380157c4f77a3286e5#file-report_crash
> -txt-L47-L96
>
How do you compile the dependency lib? It should use /MD and be non debug
for the release build.  Also the dependency build has to match the
corresponding CRT and paltform used for PHP build. Such mistakes are the
frequent reasons for fail. Quite unlikely it has something to do with PHP
itself. For the particular exception 80000003 you experience it would also
make sense to consult something like msdn or stackoverflow as that
exception is a general one and can have many causes.

Regards

Anatol

---

## #74096 — Martin Keckeis — 2014-05-09T13:48:16+00:00

URL: https://externals.io/message/73517#74096 · In reply to: #74095

Hello Anatol,

i hope/think this is the "final" hint...
SAP NW RFC is build with VS2008 (i got the compiled one...so im not 100%
sure) and i compile the php extension itself with VS2012....

I get now VS2008 + Windows SDK 6.1 and try to compile the php extension
with it....

Shouldn't be a problem for PHP 5.5 when the extension is compiled with
VS2008?




2014-05-09 15:38 GMT+02:00 Anatol Belski <anatol.php@belski.net>:

> Hi Martin,
>
> 
> > […]
> https://gist.github.com/ThaDafinser/e6380157c4f77a3286e5#file-report_crash
> > […]
> How do you compile the dependency lib? It should use /MD and be non debug
> for the release build.  Also the dependency build has to match the
> corresponding CRT and paltform used for PHP build. Such mistakes are the
> frequent reasons for fail. Quite unlikely it has something to do with PHP
> itself. For the particular exception 80000003 you experience it would also
> make sense to consult something like msdn or stackoverflow as that
> exception is a general one and can have many causes.
>
> Regards
>
> Anatol

---

## #74098 — Anatol Belski — 2014-05-09T14:24:14+00:00

URL: https://externals.io/message/73517#74098 · In reply to: #74089

Martin,


> Hello together,
>
>
> 2014-05-09 12:06 GMT+02:00 O'Neil Delpratt <oneil@saxonica.com>:
>
>
> > […]
>
>
> I also try currently to port over this extension to windows:
> https://github.com/piersharding/php-sapnwrfc/issues/6
> My progress is not bad...i think there are some incompabilities left
> between the versions.....but there are no error messages left at compile
> ...so its hard to figure out:-/
>
>
> my resources: https://wiki.php.net/internals/windows/stepbystepbuild
> http://www.php.net/manual/en/internals2.buildsys.configwin.php
> http://www.dreamincode.net/forums/topic/244215-introduction-to-creating-a-
> php-extension-for-windows/
>
> the bad things - there is no real documentation about config.w32 (i've
> gone through pecl packages and ported my code from there - at least i didnt
> found one... - what are the parameters for functions
> like EXTENSION() CHECK_LIB() CHECK_HEADER_ADD_INCLUDE().....?? - i guess
> them currently with the usage in the different pecl packages.... - what
> kind of functions are available in config.w32? - the binarys-tools are
> from 2011...no vc11 folder is created.
> http://windows.php.net/downloads/php-sdk/
Regarding the config.w32 functions - one possibility is to lookup for them
inside the configure.js as they're regular javascript functions. Generally
I'd appreciate if you could add the issues you mentioned as bug tickets
(one per ticket) and assign to the user ab. It is known but as usual with
the sparse resources it's often to choose either to code or to document.

> - in the package i have some lib dependencies -> they must be in the
> deps/bin folder - how can i change the source path? only with
> "--with-extra-libs" ?
Yes, you can either use --with-extra-libs and --with-extra-includes or
implement --with-myext=path/to/dep (or as an additional option like
--with-myext-deps). Putting the deps into the core deps would work too,
but imho that's an unclean way.

> - there is the CHECK_LIB() function -> but why the lib is not taken from
> there, instead of the deps/bin folder?
>
not sure to understand this, *.lib files should be in the deps\lib and if
those libs are some dll import libs, so the corresponding dll should be in
deps\bin

Regards

Anatol

---

## #74099 — Anatol Belski — 2014-05-09T14:32:20+00:00

URL: https://externals.io/message/73517#74099 · In reply to: #74096

> Hello Anatol,
>
>
> i hope/think this is the "final" hint... SAP NW RFC is build with VS2008
> (i got the compiled one...so im not 100%
> sure) and i compile the php extension itself with VS2012....
>
> I get now VS2008 + Windows SDK 6.1 and try to compile the php extension
> with it....
>
> Shouldn't be a problem for PHP 5.5 when the extension is compiled with
> VS2008?
>
actually it is a issue, as I mentioned before - the CRT should match. It
is any platform alike with the compatibility between different compiler
versions.

I got it, so that are the bins provided by SAP and of course there are no
sources for that. Maybe they provide some static variant of that lib? that
might work better (but depends how it's built). Or, don't they provide the
vc11 bins, maybe ask support if you can?

Regards

Anatol


>
>
> 2014-05-09 15:38 GMT+02:00 Anatol Belski <anatol.php@belski.net>:
>
>
> > […]

---

## #74100 — Anatol Belski — 2014-05-09T14:39:59+00:00

URL: https://externals.io/message/73517#74100

Hi Thomas,


> 
>
> > […]
>
> The Wiki link above does have implied instructions for building
> extensions in it already (step 14):
>
> configure --disable-all --enable-cli --enable-[yourextension]
>
> Or --with-[yourextension] depending on your needs.  But it isn't exactly
> obvious.  "$remains" doesn't mean anything to me.  But the above is
> sufficient to prepare to build a minimal PHP with support for your new
> extension.
>
> PHP is very *NIX-centric, so I've found that writing an extension first
> on a Linux host (e.g. Ubuntu) and then porting it to Windows is a lot
> easier than the reverse.
>
that is discussable while often done exactly that way. The build system on
windows mimics autotools so many function names are the same. As well as
using --with-.. if you have a dep and --enable-.. if it has none.

Regards

-anatol
