Skip to content

Commit

Permalink
[runtime] Fix the windows build. Define _WINSOCKAPI_ to fix the compi…
Browse files Browse the repository at this point in the history
…lation problems when windows.h is included before winsock2.h: http://stackoverflow.com/questions/1372480/c-redefinition-header-files.
  • Loading branch information
vargaz committed Sep 13, 2014
1 parent a8392ba commit a1f58d3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion mono/utils/mono-compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,12 @@
#endif

#include <float.h>
#define isnan(x) _isnan(x)
#define trunc(x) (((x) < 0) ? ceil((x)) : floor((x)))
#if _MSC_VER < 1800 /* VS 2013 */
#define isnan(x) _isnan(x)
#define isinf(x) (_isnan(x) ? 0 : (_fpclass(x) == _FPCLASS_NINF) ? -1 : (_fpclass(x) == _FPCLASS_PINF) ? 1 : 0)
#define isnormal(x) _finite(x)
#endif

#define popen _popen
#define pclose _pclose
Expand Down
5 changes: 5 additions & 0 deletions mono/utils/mono-poll.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ mono_poll (mono_pollfd *ufds, unsigned int nfds, int timeout)
}
#else

#ifdef HOST_WIN32
/* For select */
#include <winsock2.h>
#endif

int
mono_poll (mono_pollfd *ufds, unsigned int nfds, int timeout)
{
Expand Down
1 change: 0 additions & 1 deletion msvc/mono.def
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,6 @@ mono_metadata_guid_heap
mono_metadata_implmap_from_method
mono_metadata_init
mono_metadata_interfaces_from_typedef
mono_metadata_load_generic_param_constraints
mono_metadata_load_generic_params
mono_metadata_locate
mono_metadata_locate_token
Expand Down
4 changes: 2 additions & 2 deletions msvc/mono.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="MonoDefines">
<top_srcdir>$(MSBuildProjectDirectory)\..</top_srcdir>
Expand All @@ -9,7 +9,7 @@
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>__default_codegen__;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H;GC_NOT_DLL;WIN32_THREADS;WINVER=0x0500;_WIN32_WINNT=0x0500;_WIN32_IE=0x0501;_UNICODE;UNICODE;WIN32_THREADS;FD_SETSIZE=1024;$(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>__default_codegen__;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H;GC_NOT_DLL;WIN32_THREADS;WINVER=0x0500;_WIN32_WINNT=0x0500;_WIN32_IE=0x0501;_UNICODE;UNICODE;WIN32_THREADS;FD_SETSIZE=1024;$(PreprocessorDefinitions);_WINSOCKAPI_</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>Mswsock.lib;ws2_32.lib;ole32.lib;oleaut32.lib;psapi.lib;version.lib;advapi32.lib;winmm.lib;kernel32.lib;$(AdditionalDependencies)</AdditionalDependencies>
Expand Down

0 comments on commit a1f58d3

Please sign in to comment.