Skip to content

Commit 1411ca5

Browse files
committed
implement necessary symbol exports
1 parent f20118a commit 1411ca5

File tree

3 files changed

+48
-37
lines changed

3 files changed

+48
-37
lines changed

main/fastcgi.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -357,13 +357,13 @@ int fcgi_in_shutdown(void)
357357
return in_shutdown;
358358
}
359359

360-
void fcgi_terminate(void)
360+
FCGI_API void fcgi_terminate(void)
361361
{
362362
in_shutdown = 1;
363363
}
364364

365365
#ifndef HAVE_ATTRIBUTE_WEAK
366-
void fcgi_set_logger(fcgi_logger lg) {
366+
FCGI_API void fcgi_set_logger(fcgi_logger lg) {
367367
fcgi_log = lg;
368368
}
369369
#else
@@ -442,7 +442,7 @@ int fcgi_init(void)
442442
}
443443

444444

445-
int fcgi_is_fastcgi(void)
445+
FCGI_API int fcgi_is_fastcgi(void)
446446
{
447447
if (!is_initialized) {
448448
return fcgi_init();
@@ -451,7 +451,7 @@ int fcgi_is_fastcgi(void)
451451
}
452452
}
453453

454-
void fcgi_shutdown(void)
454+
FCGI_API void fcgi_shutdown(void)
455455
{
456456
if (is_initialized) {
457457
zend_hash_destroy(&fcgi_mgmt_vars);
@@ -543,7 +543,7 @@ static int is_port_number(const char *bindpath)
543543
return 1;
544544
}
545545

546-
int fcgi_listen(const char *path, int backlog)
546+
FCGI_API int fcgi_listen(const char *path, int backlog)
547547
{
548548
char *s;
549549
int tcp = 0;
@@ -768,7 +768,7 @@ void fcgi_set_allowed_clients(char *ip)
768768
}
769769
}
770770

771-
fcgi_request *fcgi_init_request(fcgi_request *req, int listen_socket)
771+
FCGI_API fcgi_request *fcgi_init_request(fcgi_request *req, int listen_socket)
772772
{
773773
memset(req, 0, sizeof(fcgi_request));
774774
req->listen_socket = listen_socket;
@@ -799,7 +799,7 @@ fcgi_request *fcgi_init_request(fcgi_request *req, int listen_socket)
799799
return req;
800800
}
801801

802-
void fcgi_destroy_request(fcgi_request *req) {
802+
FCGI_API void fcgi_destroy_request(fcgi_request *req) {
803803
if (req->env.buckets) {
804804
fcgi_hash_destroy(&req->env);
805805
}
@@ -1093,7 +1093,7 @@ static int fcgi_read_request(fcgi_request *req)
10931093
return 1;
10941094
}
10951095

1096-
int fcgi_read(fcgi_request *req, char *str, int len)
1096+
FCGI_API int fcgi_read(fcgi_request *req, char *str, int len)
10971097
{
10981098
int ret, n, rest;
10991099
fcgi_header hdr;
@@ -1243,7 +1243,7 @@ static int fcgi_is_allowed() {
12431243
return 0;
12441244
}
12451245

1246-
int fcgi_accept_request(fcgi_request *req)
1246+
FCGI_API int fcgi_accept_request(fcgi_request *req)
12471247
{
12481248
#ifdef _WIN32
12491249
HANDLE pipe;
@@ -1399,7 +1399,7 @@ static inline void close_packet(fcgi_request *req)
13991399
}
14001400
}
14011401

1402-
int fcgi_flush(fcgi_request *req, int close)
1402+
FCGI_API int fcgi_flush(fcgi_request *req, int close)
14031403
{
14041404
int len;
14051405

@@ -1429,7 +1429,7 @@ int fcgi_flush(fcgi_request *req, int close)
14291429
return 1;
14301430
}
14311431

1432-
int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len)
1432+
FCGI_API int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len)
14331433
{
14341434
int limit, rest;
14351435

@@ -1541,7 +1541,7 @@ int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int l
15411541
return len;
15421542
}
15431543

1544-
int fcgi_finish_request(fcgi_request *req, int force_close)
1544+
FCGI_API int fcgi_finish_request(fcgi_request *req, int force_close)
15451545
{
15461546
int ret = 1;
15471547

@@ -1555,7 +1555,7 @@ int fcgi_finish_request(fcgi_request *req, int force_close)
15551555
return ret;
15561556
}
15571557

1558-
char* fcgi_getenv(fcgi_request *req, const char* var, int var_len)
1558+
FCGI_API char* fcgi_getenv(fcgi_request *req, const char* var, int var_len)
15591559
{
15601560
unsigned int val_len;
15611561

@@ -1564,14 +1564,14 @@ char* fcgi_getenv(fcgi_request *req, const char* var, int var_len)
15641564
return fcgi_hash_get(&req->env, FCGI_HASH_FUNC(var, var_len), (char*)var, var_len, &val_len);
15651565
}
15661566

1567-
char* fcgi_quick_getenv(fcgi_request *req, const char* var, int var_len, unsigned int hash_value)
1567+
FCGI_API char* fcgi_quick_getenv(fcgi_request *req, const char* var, int var_len, unsigned int hash_value)
15681568
{
15691569
unsigned int val_len;
15701570

15711571
return fcgi_hash_get(&req->env, hash_value, (char*)var, var_len, &val_len);
15721572
}
15731573

1574-
char* fcgi_putenv(fcgi_request *req, char* var, int var_len, char* val)
1574+
FCGI_API char* fcgi_putenv(fcgi_request *req, char* var, int var_len, char* val)
15751575
{
15761576
if (!req) return NULL;
15771577
if (val == NULL) {
@@ -1582,7 +1582,7 @@ char* fcgi_putenv(fcgi_request *req, char* var, int var_len, char* val)
15821582
}
15831583
}
15841584

1585-
char* fcgi_quick_putenv(fcgi_request *req, char* var, int var_len, unsigned int hash_value, char* val)
1585+
FCGI_API char* fcgi_quick_putenv(fcgi_request *req, char* var, int var_len, unsigned int hash_value, char* val)
15861586
{
15871587
if (val == NULL) {
15881588
fcgi_hash_del(&req->env, hash_value, var, var_len);
@@ -1592,13 +1592,13 @@ char* fcgi_quick_putenv(fcgi_request *req, char* var, int var_len, unsigned int
15921592
}
15931593
}
15941594

1595-
void fcgi_loadenv(fcgi_request *req, fcgi_apply_func func, zval *array)
1595+
FCGI_API void fcgi_loadenv(fcgi_request *req, fcgi_apply_func func, zval *array)
15961596
{
15971597
fcgi_hash_apply(&req->env, func, array);
15981598
}
15991599

16001600
#ifdef _WIN32
1601-
void fcgi_impersonate(void)
1601+
FCGI_API void fcgi_impersonate(void)
16021602
{
16031603
char *os_name;
16041604

main/fastcgi.h

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@
4343
#define FCGI_PUTENV(request, name, value) \
4444
fcgi_quick_putenv(request, name, sizeof(name)-1, FCGI_HASH_FUNC(name, sizeof(name)-1), value)
4545

46+
#ifdef PHP_WIN32
47+
# ifdef FCGI_EXPORTS
48+
# define FCGI_API __declspec(dllexport)
49+
# else
50+
# define FCGI_API __declspec(dllimport)
51+
# endif
52+
#else
53+
# define FCGI_API
54+
#endif
55+
4656
typedef enum _fcgi_role {
4757
FCGI_RESPONDER = 1,
4858
FCGI_AUTHORIZER = 2,
@@ -187,39 +197,39 @@ struct _fcgi_request {
187197
};
188198

189199
int fcgi_init(void);
190-
void fcgi_shutdown(void);
191-
int fcgi_is_fastcgi(void);
200+
FCGI_API void fcgi_shutdown(void);
201+
FCGI_API int fcgi_is_fastcgi(void);
192202
int fcgi_is_closed(fcgi_request *req);
193203
void fcgi_close(fcgi_request *req, int force, int destroy);
194204
int fcgi_in_shutdown(void);
195-
void fcgi_terminate(void);
196-
int fcgi_listen(const char *path, int backlog);
197-
fcgi_request* fcgi_init_request(fcgi_request *request, int listen_socket);
198-
void fcgi_destroy_request(fcgi_request *req);
205+
FCGI_API void fcgi_terminate(void);
206+
FCGI_API int fcgi_listen(const char *path, int backlog);
207+
FCGI_API fcgi_request* fcgi_init_request(fcgi_request *request, int listen_socket);
208+
FCGI_API void fcgi_destroy_request(fcgi_request *req);
199209
void fcgi_set_allowed_clients(char *ip);
200-
int fcgi_accept_request(fcgi_request *req);
201-
int fcgi_finish_request(fcgi_request *req, int force_close);
210+
FCGI_API int fcgi_accept_request(fcgi_request *req);
211+
FCGI_API int fcgi_finish_request(fcgi_request *req, int force_close);
202212
const char *fcgi_get_last_client_ip();
203213
void fcgi_set_in_shutdown(int new_value);
204214

205215
#ifndef HAVE_ATTRIBUTE_WEAK
206216
typedef void (*fcgi_logger)(int type, const char *fmt, ...);
207-
void fcgi_set_logger(fcgi_logger lg);
217+
FCGI_API void fcgi_set_logger(fcgi_logger lg);
208218
#endif
209219

210-
char* fcgi_getenv(fcgi_request *req, const char* var, int var_len);
211-
char* fcgi_putenv(fcgi_request *req, char* var, int var_len, char* val);
212-
char* fcgi_quick_getenv(fcgi_request *req, const char* var, int var_len, unsigned int hash_value);
213-
char* fcgi_quick_putenv(fcgi_request *req, char* var, int var_len, unsigned int hash_value, char* val);
214-
void fcgi_loadenv(fcgi_request *req, fcgi_apply_func load_func, zval *array);
220+
FCGI_API char* fcgi_getenv(fcgi_request *req, const char* var, int var_len);
221+
FCGI_API char* fcgi_putenv(fcgi_request *req, char* var, int var_len, char* val);
222+
FCGI_API char* fcgi_quick_getenv(fcgi_request *req, const char* var, int var_len, unsigned int hash_value);
223+
FCGI_API char* fcgi_quick_putenv(fcgi_request *req, char* var, int var_len, unsigned int hash_value, char* val);
224+
FCGI_API void fcgi_loadenv(fcgi_request *req, fcgi_apply_func load_func, zval *array);
215225

216-
int fcgi_read(fcgi_request *req, char *str, int len);
226+
FCGI_API int fcgi_read(fcgi_request *req, char *str, int len);
217227

218-
int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len);
219-
int fcgi_flush(fcgi_request *req, int close);
228+
FCGI_API int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len);
229+
FCGI_API int fcgi_flush(fcgi_request *req, int close);
220230

221231
#ifdef PHP_WIN32
222-
void fcgi_impersonate(void);
232+
FCGI_API void fcgi_impersonate(void);
223233
#endif
224234

225235
void fcgi_set_mgmt_var(const char * name, size_t name_len, const char * value, size_t value_len);

win32/build/confutils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2599,7 +2599,8 @@ function toolset_setup_common_cflags()
25992599
{
26002600
// CFLAGS for building the PHP dll
26012601
DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP7DLLTS_EXPORTS /D PHP_EXPORTS \
2602-
/D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=" + WINVER);
2602+
/D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=" + WINVER
2603+
+ " /D FCGI_EXPORTS");
26032604

26042605
DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');
26052606
1

0 commit comments

Comments
 (0)