[System] Remove internal Win32* classes from mobile builds
authorSebastien Pouliot <sebastien@xamarin.com>
Fri, 20 Nov 2015 16:57:48 +0000 (11:57 -0500)
committerSebastien Pouliot <sebastien@xamarin.com>
Fri, 20 Nov 2015 16:57:48 +0000 (11:57 -0500)
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.

18 files changed:
mcs/class/System/System.Net.NetworkInformation/GatewayIPAddressInformationCollection.cs
mcs/class/System/System.Net.NetworkInformation/IPAddressCollection.cs
mcs/class/System/System.Net.NetworkInformation/IPAddressInformationCollection.cs
mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs
mcs/class/System/System.Net.NetworkInformation/IPGlobalStatistics.cs
mcs/class/System/System.Net.NetworkInformation/IPInterfaceProperties.cs
mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceProperties.cs
mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceStatistics.cs
mcs/class/System/System.Net.NetworkInformation/IPv6InterfaceProperties.cs
mcs/class/System/System.Net.NetworkInformation/IcmpV4Statistics.cs
mcs/class/System/System.Net.NetworkInformation/IcmpV6Statistics.cs
mcs/class/System/System.Net.NetworkInformation/MulticastIPAddressInformationCollection.cs
mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs
mcs/class/System/System.Net.NetworkInformation/TcpStatistics.cs
mcs/class/System/System.Net.NetworkInformation/UdpStatistics.cs
mcs/class/System/System.Net.NetworkInformation/UnicastIPAddressInformation.cs
mcs/class/System/System.Net.NetworkInformation/UnicastIPAddressInformationCollection.cs
mcs/class/System/mobile_System.dll.sources

index 07c8f478dee5dc33884824f8ff3db64433e6ddef..14767dd782b42e4a10bc6315ded535f930af7bcc 100644 (file)
@@ -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
        {
index 69b05505403740965fca5ba724cf79e59ac5bc3e..3900ac1f192f00d9d8d6f91690e8f010644ce870 100644 (file)
@@ -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
 }
 
 
index 40f5f70fef837f68932c36f08fcf3f9e7f8b4f17..1492fe0f925cbc906979606054c419eeed634631 100644 (file)
@@ -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<IPAddress> addresses)
                {
index b7b7ebb2468e0c1c2f4095ed85f23459984243cb..9ff24cf7f1058105751e3ec6ea05c14b83725c36 100644 (file)
@@ -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
 }
index 7a017ef80a854b6700da25c4e8ae2929b40f0e5a..749be358302b0390c4d6454279649f045cd58d69 100644 (file)
@@ -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
 }
 
index 13edcd33351156f76183ec5a80a4f931bd1c7443..3a37594d7553aeb1528d170399781c88f97dce47 100644 (file)
@@ -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
 }
 
 
index 9202c0f09a8564eb49657348597f3a4aa050d35f..33264fb4d6a7d07376d26f8f318849d69af19e54 100644 (file)
@@ -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
 }
 
index 8dd8743c85ffbcc070cc2fda0f5a766df00a786a..ba12ba067dab630b3b9c7049ab86865d6038cd2a 100644 (file)
@@ -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
        {
index e81df59229c4ca79623a7096488a5b050777cfbb..bf31050377aed351375a6e76145611ef864fa5b7 100644 (file)
@@ -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
 }
 
index bb7fab0b66c9db9e893751b6e3e5308742421f28..3ad40ed2e1cd13361e8af8d0bb0ab2ac14b265b6 100644 (file)
@@ -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
 }
 
index 7683ebd33e9bb8f86bc1331e2495520ad8bcd47b..94b05b143429e883141eb4e4e54029371f3ebc0c 100644 (file)
@@ -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
 }
 
index 218adff70d6e1788c3511bf7266ccd63c52f8939..36bd9c42de1a4e5b0bf5346432a2998a05b99bb0 100644 (file)
@@ -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<IPAddress> addresses)
                {
index 62748e573f693e4a8344a822c9eec687f543b2fe..92a5dfe0a60892c3e5321b07a0308a4754975cb3 100644 (file)
@@ -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
 }
 
index a7b46e35d6b3701a7f00af123bbc6aba70d2818d..9f8c88a2eb3f8fd0fd2024a0e0c8fb3745e86046 100644 (file)
@@ -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
 }
 
index 6126b93d79908833e023602d7b6de3cb0916f5a1..2c9d6962912f899d777f1fc66e6e886630a5c604 100644 (file)
@@ -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
 }
 
index e8c254a2a378e1ce0d9b33a1637cda3ff8d2764a..a7510f033e9bca3608bcf551146d2381f44f10a2 100644 (file)
@@ -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
        {
index 3905225f9349b93402b796819fc9de7f3444e5d6..b83959a3faf73ced0c16b365355dc387f135bc35 100644 (file)
@@ -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<IPAddress> addresses)
                {
index 270ea6b23047769a05dd0539873ba973bb78b5f0..2d502c5b7085a731208d67fa7f8d24b4715cdb8a 100644 (file)
@@ -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