Build libgcmonosgen under none desktop Windows API family.
authorlateralusX <lateralusx.github@gmail.com>
Fri, 30 Sep 2016 06:48:00 +0000 (08:48 +0200)
committerlateralusX <lateralusx.github@gmail.com>
Fri, 30 Sep 2016 06:48:00 +0000 (08:48 +0200)
Initial work to build libgcmonosgen under none desktop Windows API families.
Changes are mainly related to header files included by libgcmonosgen sources and shared
by other libraries.

mono/io-layer/io-layer.h
mono/metadata/cominterop.c
mono/metadata/marshal.c
mono/metadata/threads.c
mono/sgen/sgen-layout-stats.c
mono/utils/mono-os-semaphore.h

index a3cbe2abfee3419be56e504891aa2e749f9ed3cf..e9096e25580ee216938e36854d2668b6325b4a45 100755 (executable)
@@ -11,6 +11,9 @@
 #ifndef _MONO_IOLAYER_IOLAYER_H_
 #define _MONO_IOLAYER_IOLAYER_H_
 
+#include <config.h>
+#include <glib.h>
+
 #if defined(__WIN32__) || defined(_WIN32)
 /* Native win32 */
 #define __USE_W32_SOCKETS
@@ -25,8 +28,8 @@
 #include <ws2tcpip.h>
 #endif
 #include <psapi.h>
-#include <shlobj.h>
-/*
+
+ /*
  * Workaround for missing WSAPOLLFD typedef in mingw's winsock2.h that is required for mswsock.h below.
  * Remove once http://sourceforge.net/p/mingw/bugs/1980/ is fixed.
  */
@@ -37,7 +40,11 @@ typedef struct pollfd {
   short  revents;
 } WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD;
 #endif
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
 #include <mswsock.h>
+#endif
+
 #else  /* EVERYONE ELSE */
 #include "mono/io-layer/wapi.h"
 #include "mono/io-layer/uglify.h"
index bedd740079bfdc160e07c76ae65b67134f7af777..5f7d15560aa1c3c83d20b8664b7ae7cfe4517e34 100644 (file)
 #include <string.h>
 #include <errno.h>
 
+#if defined(HOST_WIN32)
+#include <oleauto.h>
+#endif
+
 /*
 Code shared between the DISABLE_COM and !DISABLE_COM
 */
index d12e345ca26f4f399373e70077e13595d9a9160d..162702a3d7c122c8e6c973aeabdef23dc01f58a4 100644 (file)
 #include <string.h>
 #include <errno.h>
 
+#if defined(HOST_WIN32)
+#include <objbase.h>
+#endif
+
 /* #define DEBUG_RUNTIME_CODE */
 
 #define OPDEF(a,b,c,d,e,f,g,h,i,j) \
index 7a2379628800309be9e35819f64e5e1fedf07a40..fdb6934036b3eadbe8c1263642f9d70083ef205d 100644 (file)
 #include <signal.h>
 #endif
 
+#if defined(HOST_WIN32)
+#include <objbase.h>
+#endif
+
 #if defined(PLATFORM_ANDROID) && !defined(TARGET_ARM64) && !defined(TARGET_AMD64)
 #define USE_TKILL_ON_ANDROID 1
 #endif
index 74c5c02a0278355074ab21273d63831791da11af..44ddf94b24dad9e505796d536d2d0c6f99417e14 100644 (file)
@@ -58,6 +58,11 @@ sgen_object_layout_dump (FILE *out)
        fprintf (out, "ref-array %lu\n", count_ref_array);
        fprintf (out, "vtype-array %lu\n", count_vtype_array);
 }
+#else
 
+#ifdef _MSC_VER
+// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+void __mono_win32_sgen_layout_stats_quiet_lnk4221(void) {}
 #endif
+#endif /* SGEN_OBJECT_LAYOUT_STATISTICS */
 #endif
index 9f59ce1ea821df2fa3dd849edd89d8e3a8b8aee7..c4bfe620f98edd116b07884e10c0f9b5ecae0922 100644 (file)
@@ -291,7 +291,12 @@ typedef HANDLE MonoSemType;
 static inline void
 mono_os_sem_init (MonoSemType *sem, int value)
 {
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
        *sem = CreateSemaphore (NULL, value, 0x7FFFFFFF, NULL);
+#else
+       *sem = CreateSemaphoreEx (NULL, value, 0x7FFFFFFF, NULL, 0, SEMAPHORE_ALL_ACCESS);
+#endif
+
        if (G_UNLIKELY (*sem == NULL))
                g_error ("%s: CreateSemaphore failed with error %d", __func__, GetLastError ());
 }