Include System.Net to Corelib.dll

Nov 21, 2014 at 9:57 PM
Greetings,
Is there any way I could include more .NET framework classes (like System.NET) to Corelib.dll?
My program is using the System.Net class and I can't compile it. I'm getting this kind of error.
>Il2Bc.exe myapp.cs /corelib:CoreLib.dll
....
error CS0234: The type or namespace name 'Net' does not exist in the namespace 'System' (are you missing an assembly reference?)
...
Thank you
Coordinator
Nov 22, 2014 at 8:18 AM
theoretically it can be done but not now. As C# native does not compile 100% .NET code into native code and some libraries needs review and some fixes to work. You should treat C# native as pure C++ compiler but using C# syntax. You can try to convert System.Net.dll into .ll file and append it but I can say it will not work.
Coordinator
Dec 15, 2014 at 3:19 PM
It seems I can add System.Net from Micro Framework but it supports sockets only. But I think for now it should be OK
Dec 16, 2014 at 6:46 AM
Have you tried it, did you link libws2_32 with the microframework assembly? As I recall the microframework .net library calls native methods deep down (implemented in the native runtime part on microframework) - the .net assemblies don't have that much code in them. However I recall the native calls for sockets use the typical socket, recv, send function names so it might be just a matter of linking socket library, might need to call WSAStartup separately though.
Coordinator
Dec 16, 2014 at 8:31 AM
yes, that is right, This is what I am going to do. I will take source code from System.Net (Micro framework) and will replace all Microsoft.SPOT.Net calls with correcponding C socket functions. (the same what I did for System.Console and System.Math)
Dec 16, 2014 at 12:11 PM
I think netmf sockets mostly map onto the c style names already it has a native wrapper class called SocketNative that has things like this in:
        [MethodImplAttribute(MethodImplOptions.InternalCall)]
        public static extern int socket(int family, int type, int protocol);

        [MethodImplAttribute(MethodImplOptions.InternalCall)]
        public static extern void bind(object socket, byte[] address);
So it might be just work if linked with libws2_32 (other than WSAStartup).