tpunt / pht

A new threading extension for PHP
BSD 3-Clause "New" or "Revised" License
179 stars 14 forks source link

cannot be compiled on Windows as a shared extension #1

Closed dktapps closed 6 years ago

dktapps commented 6 years ago

Reproducing configuration:

configure --disable-all --enable-cli --enable-zts --with-pht=shared

Compiler output

pht_zend.c
ext\pht\src\pht_zend.c(34): warning C4146: unary minus operator applied to unsigned type, result still unsigned
ext\pht\src\pht_zend.c(121): warning C4244: '=': conversion from 'zend_ulong' to 'uint32_t', possible loss of data
ext\pht\src\pht_zend.c(173): error C2491: 'pht_zend_array_dup': definition of dllimport function not allowed
ext\pht\src\pht_zend.c(284): error C2491: 'pht_zend_ast_copy': definition of dllimport function not allowed
ext\pht\src\pht_zend.c(322): error C2491: '_pht_zval_copy_ctor_func': definition of dllimport function not allowed
ext\pht\src\pht_copy.c(185): warning C4018: '<': signed/unsigned mismatch
ext\pht\src\pht_entry.c(283): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
ext\pht\src\pht_entry.c(288): warning C4244: '=': conversion from 'zend_long' to 'int', possible loss of data
ext\pht\src\pht_entry.c(320): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
ext\pht\src\pht_entry.c(389): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX64\x64\cl.exe"' : return code '0x2'

Looks to be something to do with the ZEND_API macros. It compiles successfully as a static extension.

tpunt commented 6 years ago

Thanks, I've removed them now (since exporting those functions as part of the Zend API was completely unnecessary anyway).

dktapps commented 6 years ago

Thanks, that works!

These might need to be fixed as well: https://github.com/tpunt/pht/blob/master/src/pht_zend.h#L22-L24

tpunt commented 6 years ago

Nice catch. I've removed them from there as well.