Compiling for Win32

Gisle Vanem gvanem at yahoo.no
Sun Sep 13 16:47:04 UTC 2020


Hello list (hope I'm still subscribed).

Trying to compile using MSVC, I once again hit this
error in lib/isc/netmgr/netmgr.c:

   netmgr/netmgr.c(223): error C2440: 'function': cannot convert from
   'isc_threadresult_t (__cdecl *)(isc_threadarg_t)' to
   'isc_threadfunc_t'
   netmgr/netmgr.c(223): warning C4024: 'isc_thread_create': different
   types for formal and actual parameter 1

A thread-function is defined as WINAPI on Windows,
remember?

A fix for me was:

--- a/netmgr/netmgr.c 2020-09-13 16:09:05
+++ b/netmgr/netmgr.c 2020-09-13 16:36:41
@@ -126,7 +126,11 @@
  nmsocket_maybe_destroy(isc_nmsocket_t *sock);
  static void
  nmhandle_free(isc_nmsocket_t *sock, isc_nmhandle_t *handle);
-static isc_threadresult_t
+
+#ifndef WINAPI
+#define WINAPI
+#endif
+static isc_threadresult_t WINAPI
  nm_thread(isc_threadarg_t worker0);
  static void
  async_cb(uv_async_t *handle);
@@ -489,7 +493,7 @@
   * nm_thread is a single worker thread, that runs uv_run event loop
   * until asked to stop.
   */
-static isc_threadresult_t
+static isc_threadresult_t WINAPI
  nm_thread(isc_threadarg_t worker0) {
         isc__networker_t *worker = (isc__networker_t *)worker0;

-----------

I amazed this has been fixed earlier.

-- 
--gv


More information about the bind-workers mailing list