Fix building Windows alongside Android Studio

Windows: resolve missing reference to _SC_OPEN_MAX

https://lists.gnu.org/archive/html/bug-gnulib/2014-08/msg00023.html
https://libwebsockets.org/lws-api-doc-master/html/libwebsockets_8h_source.html

Windows: comment duplicate x86_ptr_imm definition

Replaced by more explicit type definitions. Fixes x64 compile

Restore secondary x86_ptr_imm for non-Windows

This appears to be a necessary duplicate for other platforms.
This commit is contained in:
TwistedUmbrella 2018-04-01 22:18:09 -04:00
parent 91d1a5ae69
commit 571b68d468
2 changed files with 10 additions and 0 deletions

View File

@ -25,6 +25,10 @@
#define LWS_BUILD_HASH "unknown-build-hash"
#endif
#ifdef WIN32
#define getdtablesize() 30000
#endif
static const char *library_version = LWS_LIBRARY_VERSION " " LWS_BUILD_HASH;
/**
@ -122,7 +126,11 @@ libwebsocket_create_context(struct lws_context_creation_info *info)
context->options = info->options;
context->iface = info->iface;
/* to reduce this allocation, */
#ifdef WIN32
context->max_fds = getdtablesize ();
#else
context->max_fds = sysconf(_SC_OPEN_MAX);
#endif
lwsl_notice(" static allocation: %u + (%u x %u fds) = %u bytes\n",
sizeof(struct libwebsocket_context),
sizeof(struct libwebsocket_pollfd) +

View File

@ -229,11 +229,13 @@ struct /*__declspec(dllexport)*/ x86_ptr_imm
this->ptr=ptr;
}
#ifndef WIN32
template<typename Rv, typename ...Args>
x86_ptr_imm(Rv(* ptr)(Args...))
{
this->ptr= reinterpret_cast<void*>(ptr);
}
#endif
template<typename Rv, typename ...Args>
x86_ptr_imm(Rv(DYNACALL * ptr)(Args...))