[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39964] trunk/blender: fix link issues with MinGW - a substitute declaration(correctByteOrder) for itoln that was not present in MinGW was being used.

Antony Riakiotakis kalast at gmail.com
Tue Sep 6 13:17:29 CEST 2011


Revision: 39964
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39964
Author:   psy-fi
Date:     2011-09-06 11:17:29 +0000 (Tue, 06 Sep 2011)
Log Message:
-----------
fix link issues with MinGW - a substitute declaration(correctByteOrder) for itoln that was not present in MinGW was being used. Duplicated the declaration from <winsock2.h>(tried including but gave some errors) and added the appropriate link library, wsock32, according to MinGW documentation.

Modified Paths:
--------------
    trunk/blender/CMakeLists.txt
    trunk/blender/build_files/scons/config/win32-mingw-config.py
    trunk/blender/intern/guardedalloc/MEM_sys_types.h
    trunk/blender/source/blender/blenloader/BLO_sys_types.h

Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt	2011-09-06 10:49:55 UTC (rev 39963)
+++ trunk/blender/CMakeLists.txt	2011-09-06 11:17:29 UTC (rev 39964)
@@ -797,7 +797,7 @@
 	else()
 		# keep GCC spesific stuff here
 		if(CMAKE_COMPILER_IS_GNUCC)
-			set(PLATFORM_LINKLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid")
+			set(PLATFORM_LINKLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32")
 			set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
 
 			add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)

Modified: trunk/blender/build_files/scons/config/win32-mingw-config.py
===================================================================
--- trunk/blender/build_files/scons/config/win32-mingw-config.py	2011-09-06 10:49:55 UTC (rev 39963)
+++ trunk/blender/build_files/scons/config/win32-mingw-config.py	2011-09-06 11:17:29 UTC (rev 39964)
@@ -174,7 +174,7 @@
 
 CC_WARN = [ '-Wall' ]
 
-LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid']
+LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32']
 
 PLATFORM_LINKFLAGS = ['--stack,2097152']
 

Modified: trunk/blender/intern/guardedalloc/MEM_sys_types.h
===================================================================
--- trunk/blender/intern/guardedalloc/MEM_sys_types.h	2011-09-06 10:49:55 UTC (rev 39963)
+++ trunk/blender/intern/guardedalloc/MEM_sys_types.h	2011-09-06 11:17:29 UTC (rev 39964)
@@ -98,7 +98,8 @@
 #include <inttypes.h>
 
 #elif defined(FREE_WINDOWS)
-
+/* define htoln here, there must be a syntax error in winsock2.h in MinGW */
+unsigned long __attribute__((__stdcall__)) htonl(unsigned long);
 #include <stdint.h>
 
 #else
@@ -109,12 +110,14 @@
 #endif /* ifdef platform for types */
 
 #ifdef _WIN32
+#ifndef FREE_WINDOWS
 #ifndef htonl
 #define htonl(x) correctByteOrder(x)
 #endif
 #ifndef ntohl
 #define ntohl(x) correctByteOrder(x)
 #endif
+#endif
 #elif defined (__FreeBSD__) || defined (__OpenBSD__) 
 #include <sys/param.h>
 #elif defined (__APPLE__)

Modified: trunk/blender/source/blender/blenloader/BLO_sys_types.h
===================================================================
--- trunk/blender/source/blender/blenloader/BLO_sys_types.h	2011-09-06 10:49:55 UTC (rev 39963)
+++ trunk/blender/source/blender/blenloader/BLO_sys_types.h	2011-09-06 11:17:29 UTC (rev 39964)
@@ -93,7 +93,8 @@
 #include <inttypes.h>
 
 #elif defined(FREE_WINDOWS)
-
+/* define htoln here, there must be a syntax error in winsock2.h in MinGW */
+unsigned long __attribute__((__stdcall__)) htonl(unsigned long);
 #include <stdint.h>
 
 #else
@@ -105,8 +106,14 @@
 
 
 #ifdef _WIN32
+#ifndef FREE_WINDOWS
+#ifndef htonl
 #define htonl(x) correctByteOrder(x)
+#endif
+#ifndef ntohl
 #define ntohl(x) correctByteOrder(x)
+#endif
+#endif
 #elif defined (__FreeBSD__) || defined (__OpenBSD__) 
 #include <sys/param.h>
 #elif defined (__APPLE__)




More information about the Bf-blender-cvs mailing list