optimize fiber for windows platform

This commit is contained in:
shuxin   zheng 2021-09-16 15:17:40 +08:00
parent f3423ef849
commit cbdddcca4d
4 changed files with 16 additions and 7 deletions

View File

@ -7,6 +7,7 @@ extern "C" {
#include <stdarg.h>
#include <stdio.h>
#include "fiber/fiber_define.h"
#include "define.h"
#undef USE_PRINTF_MACRO
@ -22,28 +23,28 @@ extern "C" {
* @param fmt {const char*}
* @param ...
*/
void PRINTF(1, 2) msg_info(const char *fmt,...);
FIBER_API void PRINTF(1, 2) msg_info(const char *fmt,...);
/**
*
* @param fmt {const char*}
* @param ...
*/
void PRINTF(1, 2) msg_warn(const char *fmt,...);
FIBER_API void PRINTF(1, 2) msg_warn(const char *fmt,...);
/**
*
* @param fmt {const char*}
* @param ...
*/
void PRINTF(1, 2) msg_error(const char *fmt,...);
FIBER_API void PRINTF(1, 2) msg_error(const char *fmt,...);
/**
*
* @param fmt {const char*}
* @param ...
*/
void PRINTF(1, 2) msg_fatal(const char *fmt,...);
FIBER_API void PRINTF(1, 2) msg_fatal(const char *fmt,...);
#else
@ -71,21 +72,21 @@ void PRINTF(1, 2) msg_fatal(const char *fmt,...);
* @param size {size_t} buffer
* @return {const char*} buffer
*/
const char *last_strerror(char *buffer, size_t size);
FIBER_API const char *last_strerror(char *buffer, size_t size);
/**
* 线
* 线使
* @return {const char *}
*/
const char *last_serror(void);
FIBER_API const char *last_serror(void);
/**
*
* @param fmt {const char*}
* @param ...
*/
void PRINTF(1, 2) msg_printf(const char *fmt,...);
FIBER_API void PRINTF(1, 2) msg_printf(const char *fmt,...);
#ifdef __cplusplus
}

View File

@ -5,6 +5,8 @@
#ifndef SYS_UNIX
#include "common/pthread_patch.h"
#elif defined(SYS_WIN)
#pragma comment(lib, "Iphlpapi.lib")
#endif
#include "common/msg.h"

View File

@ -4,6 +4,8 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#elif defined(SYS_WIN)
#pragma comment(lib, "Iphlpapi.lib")
#endif
#include <string.h>

View File

@ -5,6 +5,10 @@
#include "fiber.h"
#include "hook.h"
#if defined(SYS_WIN)
#pragma comment(lib, "Iphlpapi.lib")
#endif
static struct addrinfo *create_addrinfo(const char *ip, short port,
int iptype, int socktype, int flags)
{