summaryrefslogtreecommitdiff
path: root/src/resources.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources.c')
-rw-r--r--src/resources.c78
1 files changed, 40 insertions, 38 deletions
diff --git a/src/resources.c b/src/resources.c
index dac0374..e7147d9 100644
--- a/src/resources.c
+++ b/src/resources.c
@@ -6,7 +6,7 @@
# define SECTION
#endif
-static const SECTION union { const guint8 data[50751]; const double alignment; void * const ptr;} simple_scan_resource_data = { {
+static const SECTION union { const guint8 data[50559]; const double alignment; void * const ptr;} simple_scan_resource_data = { {
0x47, 0x56, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00,
@@ -28,7 +28,7 @@ static const SECTION union { const guint8 data[50751]; const double alignment; v
0xd8, 0x00, 0x00, 0x00, 0x76, 0x8d, 0xc8, 0xbd,
0x02, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00,
0x0e, 0x00, 0x76, 0x00, 0xe8, 0x00, 0x00, 0x00,
- 0x3f, 0xc6, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00,
+ 0x7f, 0xc5, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x6f, 0x72, 0x67, 0x2f,
0x03, 0x00, 0x00, 0x00, 0x53, 0x69, 0x6d, 0x70,
0x6c, 0x65, 0x53, 0x63, 0x61, 0x6e, 0x2f, 0x00,
@@ -36,7 +36,7 @@ static const SECTION union { const guint8 data[50751]; const double alignment; v
0x65, 0x2f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2d, 0x73,
0x63, 0x61, 0x6e, 0x2e, 0x75, 0x69, 0x00, 0x00,
- 0x47, 0xc5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x87, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x3c, 0x3f, 0x78, 0x6d, 0x6c, 0x20, 0x76, 0x65,
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x31,
0x2e, 0x30, 0x22, 0x20, 0x65, 0x6e, 0x63, 0x6f,
@@ -940,35 +940,11 @@ static const SECTION union { const guint8 data[50751]; const double alignment; v
0x72, 0x3c, 0x2f, 0x70, 0x72, 0x6f, 0x70, 0x65,
0x72, 0x74, 0x79, 0x3e, 0x3c, 0x73, 0x69, 0x67,
0x6e, 0x61, 0x6c, 0x20, 0x6e, 0x61, 0x6d, 0x65,
- 0x3d, 0x22, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,
- 0x75, 0x72, 0x65, 0x2d, 0x65, 0x76, 0x65, 0x6e,
- 0x74, 0x22, 0x20, 0x68, 0x61, 0x6e, 0x64, 0x6c,
- 0x65, 0x72, 0x3d, 0x22, 0x73, 0x69, 0x6d, 0x70,
- 0x6c, 0x65, 0x5f, 0x73, 0x63, 0x61, 0x6e, 0x5f,
- 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x5f, 0x63,
- 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65,
- 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x63,
- 0x62, 0x22, 0x20, 0x73, 0x77, 0x61, 0x70, 0x70,
- 0x65, 0x64, 0x3d, 0x22, 0x6e, 0x6f, 0x22, 0x2f,
- 0x3e, 0x3c, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c,
- 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x64,
- 0x65, 0x6c, 0x65, 0x74, 0x65, 0x2d, 0x65, 0x76,
- 0x65, 0x6e, 0x74, 0x22, 0x20, 0x68, 0x61, 0x6e,
- 0x64, 0x6c, 0x65, 0x72, 0x3d, 0x22, 0x77, 0x69,
- 0x6e, 0x64, 0x6f, 0x77, 0x5f, 0x64, 0x65, 0x6c,
- 0x65, 0x74, 0x65, 0x5f, 0x65, 0x76, 0x65, 0x6e,
- 0x74, 0x5f, 0x63, 0x62, 0x22, 0x20, 0x73, 0x77,
- 0x61, 0x70, 0x70, 0x65, 0x64, 0x3d, 0x22, 0x6e,
- 0x6f, 0x22, 0x2f, 0x3e, 0x3c, 0x73, 0x69, 0x67,
- 0x6e, 0x61, 0x6c, 0x20, 0x6e, 0x61, 0x6d, 0x65,
- 0x3d, 0x22, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77,
- 0x2d, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2d, 0x65,
- 0x76, 0x65, 0x6e, 0x74, 0x22, 0x20, 0x68, 0x61,
- 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x3d, 0x22, 0x73,
- 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x73, 0x63,
- 0x61, 0x6e, 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x6f,
- 0x77, 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77,
- 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x65,
+ 0x3d, 0x22, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65,
+ 0x2d, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x20,
+ 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x3d,
+ 0x22, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x5f,
+ 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x5f, 0x65,
0x76, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x62, 0x22,
0x20, 0x73, 0x77, 0x61, 0x70, 0x70, 0x65, 0x64,
0x3d, 0x22, 0x6e, 0x6f, 0x22, 0x2f, 0x3e, 0x3c,
@@ -6391,17 +6367,43 @@ GResource *simple_scan_get_resource (void)
#define G_HAS_CONSTRUCTORS 1
-#define G_DEFINE_CONSTRUCTOR(_func) \
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#define G_MSVC_SYMBOL_PREFIX ""
+#else
+#define G_MSVC_SYMBOL_PREFIX "_"
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
static void _func(void); \
- static int _func ## _wrapper(void) { _func(); return 0; } \
+ extern int (* _array ## _func)(void); \
+ int _func ## _wrapper(void) { _func(); g_slist_find (NULL, _array ## _func); return 0; } \
+ __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
__pragma(section(".CRT$XCU",read)) \
- __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _wrapper;
+ __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
-#define G_DEFINE_DESTRUCTOR(_func) \
+#define G_MSVC_DTOR(_func,_sym_prefix) \
static void _func(void); \
- static int _func ## _constructor(void) { atexit (_func); return 0; } \
+ extern int (* _array ## _func)(void); \
+ int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL, _array ## _func); return 0; } \
+ __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
__pragma(section(".CRT$XCU",read)) \
- __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+ __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
#elif defined (_MSC_VER)