From: Sebastien Pouliot Date: Fri, 20 Nov 2015 16:57:48 +0000 (-0500) Subject: [System] Remove internal Win32* classes from mobile builds X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=9ea2f50a2adefdeadefbf8f49aa94404e3175a1f;p=mono.git [System] Remove internal Win32* classes from mobile builds This reduce the size of System.dll and also removes some Win32 specific p/invokes. They cause native linking issues for tvOS as Xcode 7.1 does not allow `-u` in bitcode-enabled builds so we have to call directly the symbols and it must exists at (native) link time. --- diff --git a/mcs/class/System/System.Net.NetworkInformation/GatewayIPAddressInformationCollection.cs b/mcs/class/System/System.Net.NetworkInformation/GatewayIPAddressInformationCollection.cs index 07c8f478dee..14767dd782b 100644 --- a/mcs/class/System/System.Net.NetworkInformation/GatewayIPAddressInformationCollection.cs +++ b/mcs/class/System/System.Net.NetworkInformation/GatewayIPAddressInformationCollection.cs @@ -92,6 +92,7 @@ namespace System.Net.NetworkInformation { } } +#if !MOBILE class Win32GatewayIPAddressInformationCollection : GatewayIPAddressInformationCollection { public static readonly Win32GatewayIPAddressInformationCollection Empty = new Win32GatewayIPAddressInformationCollection (true); @@ -127,6 +128,7 @@ namespace System.Net.NetworkInformation { get { return is_readonly; } } } +#endif class UnixGatewayIPAddressInformationCollection : GatewayIPAddressInformationCollection { diff --git a/mcs/class/System/System.Net.NetworkInformation/IPAddressCollection.cs b/mcs/class/System/System.Net.NetworkInformation/IPAddressCollection.cs index 69b05505403..3900ac1f192 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IPAddressCollection.cs +++ b/mcs/class/System/System.Net.NetworkInformation/IPAddressCollection.cs @@ -100,6 +100,7 @@ namespace System.Net.NetworkInformation { } } +#if !MOBILE class Win32IPAddressCollection : IPAddressCollection { public static readonly Win32IPAddressCollection Empty = new Win32IPAddressCollection (IntPtr.Zero); @@ -168,6 +169,7 @@ namespace System.Net.NetworkInformation { get { return is_readonly; } } } +#endif } diff --git a/mcs/class/System/System.Net.NetworkInformation/IPAddressInformationCollection.cs b/mcs/class/System/System.Net.NetworkInformation/IPAddressInformationCollection.cs index 40f5f70fef8..1492fe0f925 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IPAddressInformationCollection.cs +++ b/mcs/class/System/System.Net.NetworkInformation/IPAddressInformationCollection.cs @@ -109,6 +109,7 @@ namespace System.Net.NetworkInformation { get { return is_readonly; } } +#if !MOBILE public static IPAddressInformationCollection Win32FromAnycast (IntPtr ptr) { IPAddressInformationImplCollection c = new IPAddressInformationImplCollection (false); @@ -123,6 +124,7 @@ namespace System.Net.NetworkInformation { c.is_readonly = true; return c; } +#endif public static IPAddressInformationImplCollection LinuxFromAnycast (IList addresses) { diff --git a/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs b/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs index b7b7ebb2468..9ff24cf7f10 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs +++ b/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs @@ -46,6 +46,8 @@ namespace System.Net.NetworkInformation { { #if MONODROID return new AndroidIPGlobalProperties (); +#elif MONOTOUCH || XAMMAC + return new UnixIPGlobalProperties (); #else switch (Environment.OSVersion.Platform) { case PlatformID.Unix: @@ -190,6 +192,7 @@ namespace System.Net.NetworkInformation { } } +#if MONODROID sealed class AndroidIPGlobalProperties : UnixIPGlobalProperties { public override string DomainName { @@ -198,6 +201,7 @@ namespace System.Net.NetworkInformation { } } } +#endif // It expects /proc/net/snmp (or /usr/compat/linux/proc/net/snmp), // formatted like: @@ -403,6 +407,7 @@ namespace System.Net.NetworkInformation { } } +#if !MOBILE class Win32IPGlobalProperties : IPGlobalProperties { public const int AF_INET = 2; @@ -736,4 +741,5 @@ namespace System.Net.NetworkInformation { } } } +#endif } diff --git a/mcs/class/System/System.Net.NetworkInformation/IPGlobalStatistics.cs b/mcs/class/System/System.Net.NetworkInformation/IPGlobalStatistics.cs index 7a017ef80a8..749be358302 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IPGlobalStatistics.cs +++ b/mcs/class/System/System.Net.NetworkInformation/IPGlobalStatistics.cs @@ -142,6 +142,7 @@ namespace System.Net.NetworkInformation { } } +#if !MOBILE class Win32IPGlobalStatistics : IPGlobalStatistics { Win32_MIB_IPSTATS info; @@ -218,7 +219,7 @@ namespace System.Net.NetworkInformation { get { return info.InUnknownProtos; } } } - + [StructLayout (LayoutKind.Sequential)] struct Win32_MIB_IPSTATS { @@ -246,5 +247,6 @@ namespace System.Net.NetworkInformation { public int NumAddr; public int NumRoutes; } +#endif } diff --git a/mcs/class/System/System.Net.NetworkInformation/IPInterfaceProperties.cs b/mcs/class/System/System.Net.NetworkInformation/IPInterfaceProperties.cs index 13edcd33351..3a37594d755 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IPInterfaceProperties.cs +++ b/mcs/class/System/System.Net.NetworkInformation/IPInterfaceProperties.cs @@ -325,6 +325,7 @@ namespace System.Net.NetworkInformation { } } +#if !MOBILE class Win32IPInterfaceProperties2 : IPInterfaceProperties { readonly Win32_IP_ADAPTER_ADDRESSES addr; @@ -406,6 +407,7 @@ namespace System.Net.NetworkInformation { } } +#endif } diff --git a/mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceProperties.cs b/mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceProperties.cs index 9202c0f09a8..33264fb4d6a 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceProperties.cs +++ b/mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceProperties.cs @@ -137,6 +137,7 @@ namespace System.Net.NetworkInformation { } } +#if !MOBILE sealed class Win32IPv4InterfaceProperties : IPv4InterfaceProperties { [DllImport ("iphlpapi.dll")] @@ -198,5 +199,6 @@ namespace System.Net.NetworkInformation { public IntPtr CurrentDnsServer; // to Win32_IP_ADDR_STRING public Win32_IP_ADDR_STRING DnsServerList; } +#endif } diff --git a/mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceStatistics.cs b/mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceStatistics.cs index 8dd8743c85f..ba12ba067da 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceStatistics.cs +++ b/mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceStatistics.cs @@ -28,6 +28,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace System.Net.NetworkInformation { +#if !MOBILE class Win32IPv4InterfaceStatistics : IPv4InterfaceStatistics { Win32_MIB_IFROW info; @@ -86,6 +87,7 @@ namespace System.Net.NetworkInformation { } } +#endif class LinuxIPv4InterfaceStatistics : IPv4InterfaceStatistics { diff --git a/mcs/class/System/System.Net.NetworkInformation/IPv6InterfaceProperties.cs b/mcs/class/System/System.Net.NetworkInformation/IPv6InterfaceProperties.cs index e81df59229c..bf31050377a 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IPv6InterfaceProperties.cs +++ b/mcs/class/System/System.Net.NetworkInformation/IPv6InterfaceProperties.cs @@ -35,7 +35,7 @@ namespace System.Net.NetworkInformation { public abstract int Index { get; } public abstract int Mtu { get; } } - +#if !MOBILE class Win32IPv6InterfaceProperties : IPv6InterfaceProperties { Win32_MIB_IFROW mib; @@ -53,5 +53,6 @@ namespace System.Net.NetworkInformation { get { return mib.Mtu; } } } +#endif } diff --git a/mcs/class/System/System.Net.NetworkInformation/IcmpV4Statistics.cs b/mcs/class/System/System.Net.NetworkInformation/IcmpV4Statistics.cs index bb7fab0b66c..3ad40ed2e1c 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IcmpV4Statistics.cs +++ b/mcs/class/System/System.Net.NetworkInformation/IcmpV4Statistics.cs @@ -157,6 +157,7 @@ namespace System.Net.NetworkInformation { } } +#if !MOBILE class Win32IcmpV4Statistics : IcmpV4Statistics { Win32_MIBICMPSTATS iin, iout; @@ -269,5 +270,6 @@ namespace System.Net.NetworkInformation { public uint AddrMasks; public uint AddrMaskReps; } +#endif } diff --git a/mcs/class/System/System.Net.NetworkInformation/IcmpV6Statistics.cs b/mcs/class/System/System.Net.NetworkInformation/IcmpV6Statistics.cs index 7683ebd33e9..94b05b14342 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IcmpV6Statistics.cs +++ b/mcs/class/System/System.Net.NetworkInformation/IcmpV6Statistics.cs @@ -201,6 +201,7 @@ namespace System.Net.NetworkInformation { public const int RouterRenumbering = 138; } +#if !MOBILE class Win32IcmpV6Statistics : IcmpV6Statistics { Win32_MIBICMPSTATS_EX iin, iout; @@ -322,5 +323,6 @@ namespace System.Net.NetworkInformation { [MarshalAs (UnmanagedType.ByValArray, SizeConst = 256)] public uint [] Counts; } +#endif } diff --git a/mcs/class/System/System.Net.NetworkInformation/MulticastIPAddressInformationCollection.cs b/mcs/class/System/System.Net.NetworkInformation/MulticastIPAddressInformationCollection.cs index 218adff70d6..36bd9c42de1 100644 --- a/mcs/class/System/System.Net.NetworkInformation/MulticastIPAddressInformationCollection.cs +++ b/mcs/class/System/System.Net.NetworkInformation/MulticastIPAddressInformationCollection.cs @@ -109,6 +109,7 @@ namespace System.Net.NetworkInformation { get { return is_readonly; } } +#if !MOBILE public static MulticastIPAddressInformationCollection Win32FromMulticast (IntPtr ptr) { MulticastIPAddressInformationImplCollection c = new MulticastIPAddressInformationImplCollection (false); @@ -123,6 +124,7 @@ namespace System.Net.NetworkInformation { c.is_readonly = true; return c; } +#endif public static MulticastIPAddressInformationImplCollection LinuxFromList (List addresses) { diff --git a/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs b/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs index 62748e573f6..92a5dfe0a60 100644 --- a/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs +++ b/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs @@ -410,6 +410,7 @@ namespace System.Net.NetworkInformation { } } +#if !MOBILE class Win32NetworkInterfaceAPI : NetworkInterfaceFactory { [DllImport ("iphlpapi.dll", SetLastError = true)] @@ -457,6 +458,7 @@ namespace System.Net.NetworkInformation { throw new NotImplementedException (); } } +#endif public abstract NetworkInterface [] GetAllNetworkInterfaces (); public abstract int GetLoopbackInterfaceIndex (); @@ -464,7 +466,7 @@ namespace System.Net.NetworkInformation { public static NetworkInterfaceFactory Create () { -#if MONOTOUCH +#if MONOTOUCH || XAMMAC return new MacOsNetworkInterfaceAPI (); #else Version windowsVer51 = new Version (5, 1); @@ -718,6 +720,7 @@ namespace System.Net.NetworkInformation { } } +#if !MOBILE class Win32NetworkInterface2 : NetworkInterface { [DllImport ("iphlpapi.dll", SetLastError = true)] @@ -830,5 +833,6 @@ namespace System.Net.NetworkInformation { get { return !addr.NoMulticast; } } } +#endif } diff --git a/mcs/class/System/System.Net.NetworkInformation/TcpStatistics.cs b/mcs/class/System/System.Net.NetworkInformation/TcpStatistics.cs index a7b46e35d6b..9f8c88a2eb3 100644 --- a/mcs/class/System/System.Net.NetworkInformation/TcpStatistics.cs +++ b/mcs/class/System/System.Net.NetworkInformation/TcpStatistics.cs @@ -109,6 +109,7 @@ namespace System.Net.NetworkInformation { } } +#if !MOBILE class Win32TcpStatistics : TcpStatistics { Win32_MIB_TCPSTATS info; @@ -193,6 +194,6 @@ namespace System.Net.NetworkInformation { public uint OutRsts; public uint NumConns; } - +#endif } diff --git a/mcs/class/System/System.Net.NetworkInformation/UdpStatistics.cs b/mcs/class/System/System.Net.NetworkInformation/UdpStatistics.cs index 6126b93d799..2c9d6962912 100644 --- a/mcs/class/System/System.Net.NetworkInformation/UdpStatistics.cs +++ b/mcs/class/System/System.Net.NetworkInformation/UdpStatistics.cs @@ -73,6 +73,7 @@ namespace System.Net.NetworkInformation { } } +#if !MOBILE class Win32UdpStatistics : UdpStatistics { Win32_MIB_UDPSTATS info; @@ -111,5 +112,6 @@ namespace System.Net.NetworkInformation { public uint OutDatagrams; public int NumAddrs; } +#endif } diff --git a/mcs/class/System/System.Net.NetworkInformation/UnicastIPAddressInformation.cs b/mcs/class/System/System.Net.NetworkInformation/UnicastIPAddressInformation.cs index e8c254a2a37..a7510f033e9 100644 --- a/mcs/class/System/System.Net.NetworkInformation/UnicastIPAddressInformation.cs +++ b/mcs/class/System/System.Net.NetworkInformation/UnicastIPAddressInformation.cs @@ -32,6 +32,7 @@ using System.Runtime.InteropServices; using System.Net.Sockets; namespace System.Net.NetworkInformation { +#if !MOBILE class Win32UnicastIPAddressInformation : UnicastIPAddressInformation { int if_index; @@ -105,6 +106,7 @@ namespace System.Net.NetworkInformation { get { return info.SuffixOrigin; } } } +#endif class LinuxUnicastIPAddressInformation : UnicastIPAddressInformation { diff --git a/mcs/class/System/System.Net.NetworkInformation/UnicastIPAddressInformationCollection.cs b/mcs/class/System/System.Net.NetworkInformation/UnicastIPAddressInformationCollection.cs index 3905225f934..b83959a3faf 100644 --- a/mcs/class/System/System.Net.NetworkInformation/UnicastIPAddressInformationCollection.cs +++ b/mcs/class/System/System.Net.NetworkInformation/UnicastIPAddressInformationCollection.cs @@ -111,6 +111,7 @@ namespace System.Net.NetworkInformation { get { return is_readonly; } } +#if !MOBILE public static UnicastIPAddressInformationCollection Win32FromUnicast (int ifIndex, IntPtr ptr) { UnicastIPAddressInformationImplCollection c = new UnicastIPAddressInformationImplCollection (false); @@ -122,6 +123,7 @@ namespace System.Net.NetworkInformation { c.is_readonly = true; return c; } +#endif public static UnicastIPAddressInformationCollection LinuxFromList (List addresses) { diff --git a/mcs/class/System/mobile_System.dll.sources b/mcs/class/System/mobile_System.dll.sources index 270ea6b2304..2d502c5b708 100644 --- a/mcs/class/System/mobile_System.dll.sources +++ b/mcs/class/System/mobile_System.dll.sources @@ -104,7 +104,6 @@ System.Net.NetworkInformation/TcpStatistics.cs System.Net.NetworkInformation/UdpStatistics.cs System.Net.NetworkInformation/UnicastIPAddressInformation.cs System.Net.NetworkInformation/UnicastIPAddressInformationCollection.cs -System.Net.NetworkInformation/Win32NetworkInterfaceMarshal.cs System.Net.Security/AuthenticatedStream.cs System.Net.Security/AuthenticationLevel.cs System.Net.Security/EncryptionPolicy.cs