[MINGW]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 9 Nov 2010 20:43:09 +0000 (20:43 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 9 Nov 2010 20:43:09 +0000 (20:43 +0000)
special stuff for MSVC

svn path=/branches/cmake-bringup/; revision=49543

lib/3rdparty/mingw/CMakeLists.txt
lib/3rdparty/mingw/mscmain.c [new file with mode: 0644]

index 6d813a8..9260358 100644 (file)
@@ -18,7 +18,6 @@ list(APPEND MINGW_COMMON_SOURCE
     CRT_glob.c
     crt_handler.c
     dllentry.c
-    gccmain.c
     gs_support.c
     merr.c
     mingw_helpers.c
@@ -38,6 +37,12 @@ list(APPEND MINGW_COMMON_SOURCE
     ofmt_stub.c
     cxa_pure_virtual.c)
 
+if(MSVC)
+list(APPEND MINGW_COMMON_SOURCE mscmain.c)
+else()
+list(APPEND MINGW_COMMON_SOURCE gccmain.c)
+endif()
+
 add_library(mingw_common ${MINGW_COMMON_SOURCE})
 
 if(NOT MSVC)
@@ -69,5 +74,5 @@ set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a PROPERTIES
 add_custom_target(oldnames ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a)
 
 add_library(getopt getopt.c)
-set_property(TARGET getopt PROPERTY COMPILE_DEFINITIONS _DLL __USE_CRTIMP)
+set_property(TARGET getopt PROPERTY COMPILE_DEFINITIONS _DLL1 __USE_CRTIMP)
 add_dependencies(getopt psdk)
diff --git a/lib/3rdparty/mingw/mscmain.c b/lib/3rdparty/mingw/mscmain.c
new file mode 100644 (file)
index 0000000..110cd1a
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#include <windows.h>
+#include <stdlib.h>
+
+int _fltused;
+
+void
+_cdecl
+_alloca_probe_16(void)
+{
+}
+
+void
+__do_global_dtors (void)
+{
+
+}
+
+void
+__do_global_ctors (void)
+{
+
+}
+
+BOOL
+WINAPI
+_CRT_INIT0(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
+{
+    return TRUE;
+}
+
+static int initialized = 0;
+
+void
+__main (void)
+{
+    if (!initialized)
+    {
+        initialized = 1;
+        __do_global_ctors ();
+    }
+}
+
+