Skip to content

Commit ea77bdf

Browse files
committed
Enable COM in classlibs for win32
The runtime for Windows still has valid implementations for COM calls. In the case of this bug IsComOjbect needs to behave correctly. The intention of this PR is to set DISABLE_COM for only mac and linux for unity jit and unity apt profiles. fixes case 1358705
1 parent 3ade47b commit ea77bdf

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

mcs/build/profiles/unityaot.make

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ PROFILE_MCS_FLAGS = \
3131
-d:UNITY \
3232
-d:UNITY_AOT \
3333
-d:MOBILE,MOBILE_LEGACY \
34-
-d:DISABLE_COM \
3534
-d:FULL_AOT_DESKTOP \
3635
-d:FULL_AOT_RUNTIME \
3736
$(PLATFORM_FLAGS) \
@@ -46,4 +45,12 @@ NO_INSTALL = yes
4645
AOT_FRIENDLY_PROFILE = yes
4746
ALWAYS_AOT_BCL = yes
4847
MOBILE_PROFILE = yes
49-
NO_SRE = yes
48+
NO_SRE = yes
49+
50+
ifeq ($(HOST_PLATFORM),macos)
51+
PROFILE_MCS_FLAGS += -d:DISABLE_COM
52+
endif
53+
54+
ifeq ($(HOST_PLATFORM),linux)
55+
PROFILE_MCS_FLAGS += -d:DISABLE_COM
56+
endif

mcs/build/profiles/unityjit.make

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ profile-check:
1111
@:
1212

1313
DEFAULT_REFERENCES = mscorlib
14-
PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:UNITY_JIT -d:UNITY -d:WIN_PLATFORM -d:DISABLE_COM -nowarn:1699 -nostdlib $(PLATFORM_DEBUG_FLAGS)
14+
PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:UNITY_JIT -d:UNITY -d:WIN_PLATFORM -nowarn:1699 -nostdlib $(PLATFORM_DEBUG_FLAGS)
1515
API_BIN_PROFILE = v4.7.1
1616

1717
FRAMEWORK_VERSION = 4.5
@@ -20,8 +20,10 @@ XBUILD_VERSION = 4.0
2020
ifeq ($(HOST_PLATFORM),macos)
2121
MONO_FEATURE_APPLETLS=1
2222
ENABLE_GSS=1
23+
PROFILE_MCS_FLAGS += -d:DISABLE_COM
2324
endif
2425

2526
ifeq ($(HOST_PLATFORM),linux)
2627
ENABLE_GSS=1
28+
PROFILE_MCS_FLAGS += -d:DISABLE_COM
2729
endif

mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ public static object GetUniqueObjectForIUnknown (IntPtr unknown)
856856
throw new PlatformNotSupportedException ();
857857
}
858858

859-
#if (!MOBILE && !UNITY) || UNITY_AOT
859+
#if (!MOBILE && !DISABLE_COM) || (UNITY_AOT && !DISABLE_COM)
860860
[MethodImplAttribute (MethodImplOptions.InternalCall)]
861861
public extern static bool IsComObject (object o);
862862
#else

0 commit comments

Comments
 (0)