-
-
Save cmb69/d88a91004713fc7a454d9c699edd38dd to your computer and use it in GitHub Desktop.
ext-fiber
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From f6146068e25bc957024db811b78ae3b6615e4fc5 Mon Sep 17 00:00:00 2001 | |
From: "Christoph M. Becker" <cmbecker69@gmx.de> | |
Date: Sat, 21 Nov 2020 16:59:33 +0100 | |
Subject: [PATCH] [WIP] Fix Windows build | |
--- | |
config.w32 | 2 +- | |
include/fiber.h | 18 +++++++++++++++--- | |
include/fiber_stack.h | 2 +- | |
src/fiber.c | 4 ++-- | |
4 files changed, 19 insertions(+), 7 deletions(-) | |
diff --git a/config.w32 b/config.w32 | |
index d16b537..9a2c703 100644 | |
--- a/config.w32 | |
+++ b/config.w32 | |
@@ -3,5 +3,5 @@ ARG_ENABLE('fiber', 'fiber support', 'yes'); | |
if (PHP_FIBER != 'no') { | |
AC_DEFINE('HAVE_FIBER', 1, 'fiber support enabled'); | |
- EXTENSION('fiber', 'src/php_fiber.c src/fiber.c src/fiber_winfib.c', null, '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1'); | |
+ EXTENSION('fiber', 'src\\php_fiber.c src\\fiber.c src\\fiber_winfib.c', null, '/Iinclude /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /DPHP_FIBER_EXPORTS=1'); | |
} | |
diff --git a/include/fiber.h b/include/fiber.h | |
index 70e42bb..73b62a0 100644 | |
--- a/include/fiber.h | |
+++ b/include/fiber.h | |
@@ -24,9 +24,21 @@ void zend_fiber_ce_unregister(); | |
void zend_fiber_shutdown(); | |
-extern ZEND_API zend_class_entry *zend_ce_fiber; | |
-extern ZEND_API zend_class_entry *zend_ce_fiber_scheduler; | |
-extern ZEND_API zend_class_entry *zend_ce_continuation; | |
+#ifdef PHP_WIN32 | |
+# ifdef PHP_FIBER_EXPORTS | |
+# define PHP_FIBER_API __declspec(dllexport) | |
+# else | |
+# define PHP_FIBER_API __declspec(dllimport) | |
+# endif | |
+#elif defined(__GNUC__) && __GNUC__ >= 4 | |
+# define PHP_FIBER_API __attribute__ ((visibility("default"))) | |
+#else | |
+# define PHP_FIBER_API | |
+#endif | |
+ | |
+extern PHP_FIBER_API zend_class_entry *zend_ce_fiber; | |
+extern PHP_FIBER_API zend_class_entry *zend_ce_fiber_scheduler; | |
+extern PHP_FIBER_API zend_class_entry *zend_ce_continuation; | |
typedef void* zend_fiber_context; | |
diff --git a/include/fiber_stack.h b/include/fiber_stack.h | |
index 38e583e..7263c7c 100644 | |
--- a/include/fiber_stack.h | |
+++ b/include/fiber_stack.h | |
@@ -14,7 +14,7 @@ | |
#ifndef FIBER_STACK_H | |
#define FIBER_STACK_H | |
-#include "php_config.h" | |
+// #include "php_config.h" | |
typedef struct _zend_fiber_stack { | |
void *pointer; | |
diff --git a/src/fiber.c b/src/fiber.c | |
index 3eaf904..8172248 100644 | |
--- a/src/fiber.c | |
+++ b/src/fiber.c | |
@@ -24,8 +24,8 @@ | |
#include "php_fiber.h" | |
#include "fiber.h" | |
-ZEND_API zend_class_entry *zend_ce_fiber; | |
-ZEND_API zend_class_entry *zend_ce_fiber_scheduler; | |
+PHP_FIBER_API zend_class_entry *zend_ce_fiber; | |
+PHP_FIBER_API zend_class_entry *zend_ce_fiber_scheduler; | |
static zend_class_entry *zend_ce_reflection_fiber; | |
-- | |
2.29.2.windows.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment