Skip to content

Commit 1ba2b40

Browse files
author
TenHian
committed
For MinGW-w64 call
1 parent c65a702 commit 1ba2b40

File tree

10 files changed

+44
-38
lines changed

10 files changed

+44
-38
lines changed

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ EMBED_GLOBAL_OBJS_RESP=@"C:\php-sdk\phpdev\vs16\x64\php-src\x64\Release_TS\resp\
120120

121121
CFLAGS_EMBED_OBJ=$(CFLAGS_EMBED)
122122

123-
SAPI_TARGETS=php.exe php8embed.lib
123+
SAPI_TARGETS=php.exe php8embed.dll
124124

125125
CFLAGS_BD_EXT_DATE=/Fp$(BUILD_DIR)\ext\date\ /FR$(BUILD_DIR)\ext\date\ /Fd$(BUILD_DIR)\ext\date\
126126

@@ -653,10 +653,10 @@ $(BUILD_DIR)\php8embed.lib.res: win32\build\template.rc
653653

654654
$(BUILD_DIR)\php8embed.lib.manifest: win32\build\default.manifest
655655
@copy $(PHP_SRC_DIR)\win32\build\default.manifest $(BUILD_DIR)\php8embed.lib.manifest >nul
656-
php8embed.lib: $(BUILD_DIR)\php8embed.lib
656+
php8embed.dll: $(BUILD_DIR)\php8embed.dll
657657
@echo SAPI sapi\embed build complete
658-
$(BUILD_DIR)\php8embed.lib: $(DEPS_EMBED) $(EMBED_GLOBAL_OBJS) $(BUILD_DIR)\$(PHPLIB) $(BUILD_DIR)\php8embed.lib.res $(BUILD_DIR)\php8embed.lib.manifest
659-
@$(MAKE_LIB) /nologo /out:$(BUILD_DIR)\php8embed.lib $(ARFLAGS) $(EMBED_GLOBAL_OBJS_RESP) $(BUILD_DIR)\$(PHPLIB) $(ARFLAGS_EMBED) $(LIBS_EMBED) $(BUILD_DIR)\php8embed.lib.res
658+
$(BUILD_DIR)\php8embed.dll: $(DEPS_EMBED) $(EMBED_GLOBAL_OBJS) $(BUILD_DIR)\$(PHPLIB) $(BUILD_DIR)\php8embed.lib.res $(BUILD_DIR)\php8embed.lib.manifest
659+
@"$(LINK)" /nologo /DLL /out:$(BUILD_DIR)\php8embed.dll $(ARFLAGS) $(EMBED_GLOBAL_OBJS_RESP) $(BUILD_DIR)\$(PHPLIB) $(ARFLAGS_EMBED) $(LIBS_EMBED) $(BUILD_DIR)\php8embed.lib.res
660660

661661

662662
# objects for EXT date

Zend/zend_portability.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
#endif
8989

9090
#if defined(ZEND_WIN32) && !defined(__clang__)
91-
# define ZEND_ASSUME(c) __assume(c)
91+
# define ZEND_ASSUME(c) assert(c)
9292
#elif defined(__clang__) && __has_builtin(__builtin_assume)
9393
# pragma clang diagnostic ignored "-Wassume"
9494
# define ZEND_ASSUME(c) __builtin_assume(c)
@@ -291,7 +291,7 @@ char *alloca();
291291
#elif defined(_MSC_VER) && defined(_M_IX86) && _MSC_VER == 1700
292292
# define ZEND_FASTCALL __fastcall
293293
#elif defined(_MSC_VER) && _MSC_VER >= 1800 && !defined(__clang__)
294-
# define ZEND_FASTCALL __vectorcall
294+
# define ZEND_FASTCALL __fastcall
295295
#else
296296
# define ZEND_FASTCALL
297297
#endif
@@ -342,7 +342,7 @@ char *alloca();
342342
# define zend_never_inline
343343
# endif
344344
# elif defined(_MSC_VER)
345-
# define zend_always_inline __forceinline
345+
# define zend_always_inline inline
346346
# define zend_never_inline __declspec(noinline)
347347
# else
348348
# if __has_attribute(always_inline)

ext/hash/murmur/PMurHash.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ on big endian machines, or a byte-by-byte read if the endianess is unknown.
6969

7070
/* Find best way to ROTL */
7171
#if defined(_MSC_VER)
72-
#define FORCE_INLINE static __forceinline
72+
#define FORCE_INLINE static inline
7373
#include <stdlib.h> /* Microsoft put _rotl declaration in here */
7474
#define ROTL32(x,y) _rotl(x,y)
7575
#else

ext/hash/murmur/PMurHash128.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ on big endian machines.
6161

6262
/* Find best way to ROTL */
6363
#if defined(_MSC_VER)
64-
#define FORCE_INLINE static __forceinline
64+
#define FORCE_INLINE static inline
6565
#include <stdlib.h> /* Microsoft put _rotl declaration in here */
6666
#define ROTL32(x,y) _rotl(x,y)
6767
#define ROTL64(x,y) _rotl64(x,y)

ext/hash/xxhash/xxhash.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1530,7 +1530,7 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size)
15301530
# define XXH_FORCE_INLINE static __inline__ __attribute__((always_inline, unused))
15311531
# define XXH_NO_INLINE static __attribute__((noinline))
15321532
#elif defined(_MSC_VER) /* Visual Studio */
1533-
# define XXH_FORCE_INLINE static __forceinline
1533+
# define XXH_FORCE_INLINE static inline
15341534
# define XXH_NO_INLINE static __declspec(noinline)
15351535
#elif defined (__cplusplus) \
15361536
|| (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) /* C99 */

ext/opcache/jit/vtune/ittnotify_config.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@
161161
#define LIBITTAPI_CALL ITTAPI_CDECL
162162

163163
#if ITT_PLATFORM==ITT_PLATFORM_WIN
164-
/* use __forceinline (VC++ specific) */
165-
#define ITT_INLINE __forceinline
164+
/* use inline (VC++ specific) */
165+
#define ITT_INLINE inline
166166
#define ITT_INLINE_ATTRIBUTE /* nothing */
167167
#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
168168
/*

sapi/embed/php_embed.h

+9-3
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,16 @@
3535
php_embed_shutdown(); \
3636
}
3737

38-
#ifndef PHP_WIN32
39-
#define EMBED_SAPI_API SAPI_API
38+
// #ifndef PHP_WIN32
39+
// #define EMBED_SAPI_API SAPI_API
40+
// #else
41+
// #define EMBED_SAPI_API
42+
// #endif
43+
44+
#ifndef __MINGW64__
45+
#define EMBED_SAPI_API __declspec(dllexport)
4046
#else
41-
#define EMBED_SAPI_API
47+
#define EMBED_SAPI_API __declspec(dllimport)
4248
#endif
4349

4450
#ifdef ZTS

win32/codepage.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ ZEND_TLS const struct php_win32_cp *orig_in_cp = NULL;
3535

3636
#include "cp_enc_map.c"
3737

38-
__forceinline static wchar_t *php_win32_cp_to_w_int(const char* in, size_t in_len, size_t *out_len, UINT cp, DWORD flags)
38+
inline static wchar_t *php_win32_cp_to_w_int(const char* in, size_t in_len, size_t *out_len, UINT cp, DWORD flags)
3939
{/*{{{*/
4040
wchar_t *ret;
4141
int ret_len, tmp_len;
@@ -241,7 +241,7 @@ PW32CP wchar_t *php_win32_cp_conv_ascii_to_w(const char* in, size_t in_len, size
241241
}/*}}}*/
242242
#undef ASCII_FAIL_RETURN
243243

244-
__forceinline static char *php_win32_cp_from_w_int(const wchar_t* in, size_t in_len, size_t *out_len, UINT cp, DWORD flags)
244+
inline static char *php_win32_cp_from_w_int(const wchar_t* in, size_t in_len, size_t *out_len, UINT cp, DWORD flags)
245245
{/*{{{*/
246246
int r;
247247
int target_len, tmp_len;
@@ -306,7 +306,7 @@ PW32CP char *php_win32_cp_conv_from_w(DWORD cp, DWORD flags, const wchar_t* in,
306306
}/*}}}*/
307307

308308
/* This is only usable after the startup phase*/
309-
__forceinline static char *php_win32_cp_get_enc(void)
309+
inline static char *php_win32_cp_get_enc(void)
310310
{/*{{{*/
311311
char *enc = NULL;
312312
const zend_encoding *zenc;

win32/codepage.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ PW32CP wchar_t *php_win32_cp_env_any_to_w(const char* env);
7676
/* This function tries to make the best guess to convert any
7777
given string to a wide char, also preferring the fastest code
7878
path to unicode. It returns NULL on fail. */
79-
__forceinline static wchar_t *php_win32_cp_conv_any_to_w(const char* in, size_t in_len, size_t *out_len)
79+
inline static wchar_t *php_win32_cp_conv_any_to_w(const char* in, size_t in_len, size_t *out_len)
8080
{/*{{{*/
8181
wchar_t *ret = NULL;
8282

@@ -117,7 +117,7 @@ __forceinline static wchar_t *php_win32_cp_conv_any_to_w(const char* in, size_t
117117
/* This function converts from unicode function output back to PHP. If
118118
the PHP's current charset is not compatible with unicode, so the currently
119119
configured CP will be used. */
120-
__forceinline static char *php_win32_cp_conv_w_to_any(const wchar_t* in, size_t in_len, size_t *out_len)
120+
inline static char *php_win32_cp_conv_w_to_any(const wchar_t* in, size_t in_len, size_t *out_len)
121121
{/*{{{*/
122122
return php_win32_cp_conv_w_to_cur(in, in_len, out_len);
123123
}/*}}}*/

win32/ioutil.h

+18-18
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ BOOL php_win32_ioutil_init(void);
177177

178178
/* Keep these functions aliased for case some additional handling
179179
is needed later. */
180-
__forceinline static wchar_t *php_win32_ioutil_conv_any_to_w(const char* in, size_t in_len, size_t *out_len)
180+
inline static wchar_t *php_win32_ioutil_conv_any_to_w(const char* in, size_t in_len, size_t *out_len)
181181
{/*{{{*/
182182
wchar_t *mb, *ret;
183183
size_t mb_len;
@@ -251,7 +251,7 @@ __forceinline static wchar_t *php_win32_ioutil_conv_any_to_w(const char* in, siz
251251
#define php_win32_ioutil_cur_to_w php_win32_cp_cur_to_w
252252
#define php_win32_ioutil_w_to_any php_win32_cp_w_to_any
253253
#define php_win32_ioutil_conv_w_to_any php_win32_cp_conv_w_to_any
254-
/*__forceinline static char *php_win32_ioutil_w_to_any(wchar_t* w_source_ptr)
254+
/*inline static char *php_win32_ioutil_w_to_any(wchar_t* w_source_ptr)
255255
{
256256
return php_win32_cp_w_to_any(w_source_ptr);
257257
}*/
@@ -275,7 +275,7 @@ PW32IO wchar_t *php_win32_ioutil_realpath_w_ex0(const wchar_t *path, wchar_t *re
275275
PW32IO int php_win32_ioutil_symlink_w(const wchar_t *target, const wchar_t *link);
276276
PW32IO int php_win32_ioutil_link_w(const wchar_t *target, const wchar_t *link);
277277

278-
__forceinline static int php_win32_ioutil_access(const char *path, mode_t mode)
278+
inline static int php_win32_ioutil_access(const char *path, mode_t mode)
279279
{/*{{{*/
280280
PHP_WIN32_IOUTIL_INIT_W(path)
281281
int ret, err;
@@ -300,7 +300,7 @@ __forceinline static int php_win32_ioutil_access(const char *path, mode_t mode)
300300
return ret;
301301
}/*}}}*/
302302

303-
__forceinline static int php_win32_ioutil_open(const char *path, int flags, ...)
303+
inline static int php_win32_ioutil_open(const char *path, int flags, ...)
304304
{/*{{{*/
305305
mode_t mode = 0;
306306
PHP_WIN32_IOUTIL_INIT_W(path)
@@ -335,7 +335,7 @@ __forceinline static int php_win32_ioutil_open(const char *path, int flags, ...)
335335
return ret;
336336
}/*}}}*/
337337

338-
__forceinline static int php_win32_ioutil_unlink(const char *path)
338+
inline static int php_win32_ioutil_unlink(const char *path)
339339
{/*{{{*/
340340
PHP_WIN32_IOUTIL_INIT_W(path)
341341
int ret = -1;
@@ -359,7 +359,7 @@ __forceinline static int php_win32_ioutil_unlink(const char *path)
359359
return ret;
360360
}/*}}}*/
361361

362-
__forceinline static int php_win32_ioutil_rmdir(const char *path)
362+
inline static int php_win32_ioutil_rmdir(const char *path)
363363
{/*{{{*/
364364
PHP_WIN32_IOUTIL_INIT_W(path)
365365
int ret = 0;
@@ -386,7 +386,7 @@ __forceinline static int php_win32_ioutil_rmdir(const char *path)
386386
return ret;
387387
}/*}}}*/
388388

389-
__forceinline static FILE *php_win32_ioutil_fopen(const char *patha, const char *modea)
389+
inline static FILE *php_win32_ioutil_fopen(const char *patha, const char *modea)
390390
{/*{{{*/
391391
FILE *ret;
392392
wchar_t modew[16] = {0};
@@ -418,7 +418,7 @@ __forceinline static FILE *php_win32_ioutil_fopen(const char *patha, const char
418418
return ret;
419419
}/*}}}*/
420420

421-
__forceinline static int php_win32_ioutil_rename(const char *oldnamea, const char *newnamea)
421+
inline static int php_win32_ioutil_rename(const char *oldnamea, const char *newnamea)
422422
{/*{{{*/
423423
wchar_t *oldnamew;
424424
wchar_t *newnamew;
@@ -462,7 +462,7 @@ __forceinline static int php_win32_ioutil_rename(const char *oldnamea, const cha
462462
return ret;
463463
}/*}}}*/
464464

465-
__forceinline static int php_win32_ioutil_chdir(const char *patha)
465+
inline static int php_win32_ioutil_chdir(const char *patha)
466466
{/*{{{*/
467467
int ret;
468468
wchar_t *pathw = php_win32_ioutil_any_to_w(patha);
@@ -487,7 +487,7 @@ __forceinline static int php_win32_ioutil_chdir(const char *patha)
487487
return ret;
488488
}/*}}}*/
489489

490-
__forceinline static char *php_win32_ioutil_getcwd(char *buf, size_t len)
490+
inline static char *php_win32_ioutil_getcwd(char *buf, size_t len)
491491
{/*{{{*/
492492
wchar_t tmp_bufw[PHP_WIN32_IOUTIL_MAXPATHLEN];
493493
char *tmp_bufa = NULL;
@@ -527,7 +527,7 @@ __forceinline static char *php_win32_ioutil_getcwd(char *buf, size_t len)
527527
}/*}}}*/
528528

529529
/* TODO improve with usage of native APIs, split for _a and _w. */
530-
__forceinline static int php_win32_ioutil_chmod(const char *patha, int mode)
530+
inline static int php_win32_ioutil_chmod(const char *patha, int mode)
531531
{/*{{{*/
532532
wchar_t *pathw = php_win32_ioutil_any_to_w(patha);
533533
int err = 0;
@@ -554,7 +554,7 @@ __forceinline static int php_win32_ioutil_chmod(const char *patha, int mode)
554554
return ret;
555555
}/*}}}*/
556556

557-
__forceinline static int php_win32_ioutil_mkdir(const char *path, mode_t mode)
557+
inline static int php_win32_ioutil_mkdir(const char *path, mode_t mode)
558558
{/*{{{*/
559559
int ret;
560560
DWORD err = 0;
@@ -579,7 +579,7 @@ __forceinline static int php_win32_ioutil_mkdir(const char *path, mode_t mode)
579579
return ret;
580580
}/*}}}*/
581581

582-
__forceinline static int php_win32_ioutil_symlink(const char *target, const char *link)
582+
inline static int php_win32_ioutil_symlink(const char *target, const char *link)
583583
{/*{{{*/
584584
wchar_t *targetw, *linkw;
585585
int ret;
@@ -605,7 +605,7 @@ __forceinline static int php_win32_ioutil_symlink(const char *target, const char
605605
return ret;
606606
}/*}}}*/
607607

608-
__forceinline static int php_win32_ioutil_link(const char *target, const char *link)
608+
inline static int php_win32_ioutil_link(const char *target, const char *link)
609609
{/*{{{*/
610610
wchar_t *targetw, *linkw;
611611
int ret;
@@ -632,7 +632,7 @@ __forceinline static int php_win32_ioutil_link(const char *target, const char *l
632632

633633
PW32IO char *realpath(const char *path, char *resolved);
634634

635-
__forceinline static char *php_win32_ioutil_realpath_ex0(const char *path, char *resolved, PBY_HANDLE_FILE_INFORMATION info)
635+
inline static char *php_win32_ioutil_realpath_ex0(const char *path, char *resolved, PBY_HANDLE_FILE_INFORMATION info)
636636
{/*{{{*/
637637
wchar_t retw[PHP_WIN32_IOUTIL_MAXPATHLEN];
638638
char *reta;
@@ -677,7 +677,7 @@ __forceinline static char *php_win32_ioutil_realpath_ex0(const char *path, char
677677
return resolved;
678678
}/*}}}*/
679679

680-
__forceinline static char *php_win32_ioutil_realpath(const char *path, char *resolved)
680+
inline static char *php_win32_ioutil_realpath(const char *path, char *resolved)
681681
{/*{{{*/
682682
return php_win32_ioutil_realpath_ex0(path, resolved, NULL);
683683
}/*}}}*/
@@ -741,7 +741,7 @@ typedef struct {
741741
PW32IO int php_win32_ioutil_stat_ex_w(const wchar_t *path, size_t path_len, php_win32_ioutil_stat_t *buf, int lstat);
742742
PW32IO int php_win32_ioutil_fstat(int fd, php_win32_ioutil_stat_t *buf);
743743

744-
__forceinline static int php_win32_ioutil_stat_ex(const char *path, php_win32_ioutil_stat_t *buf, int lstat)
744+
inline static int php_win32_ioutil_stat_ex(const char *path, php_win32_ioutil_stat_t *buf, int lstat)
745745
{/*{{{*/
746746
size_t pathw_len;
747747
wchar_t *pathw = php_win32_ioutil_conv_any_to_w(path, PHP_WIN32_CP_IGNORE_LEN, &pathw_len);
@@ -763,7 +763,7 @@ __forceinline static int php_win32_ioutil_stat_ex(const char *path, php_win32_io
763763

764764
PW32IO ssize_t php_win32_ioutil_readlink_w(const wchar_t *path, wchar_t *buf, size_t buf_len);
765765

766-
__forceinline static ssize_t php_win32_ioutil_readlink(const char *path, char *buf, size_t buf_len)
766+
inline static ssize_t php_win32_ioutil_readlink(const char *path, char *buf, size_t buf_len)
767767
{/*{{{*/
768768
size_t pathw_len, ret_buf_len;
769769
wchar_t *pathw = php_win32_ioutil_conv_any_to_w(path, PHP_WIN32_CP_IGNORE_LEN, &pathw_len);

0 commit comments

Comments
 (0)