[Mono-dev] Marshal.SizeOf differences on .NET and Mono
Hi all, I'm not entirely sure who has the bug here, Mono seems like it is more logically correct, but perhaps I'm missing an attribute somewhere. Marshal.SizeOf(typeof(ImClasses)) is not what you'd expect, and is different depending on if it runs under Mono 2.8 (on Windows) or .NET 3.5. .NET: Class size: 8 Mono: Class size: 1 Struct sizes are both 1. Thanks, Joe using System; using System.Runtime.InteropServices; class Program { [StructLayout(LayoutKind.Sequential, Pack = 1)] public class ImaClass { public byte A; } [StructLayout(LayoutKind.Sequential, Pack = 1)] public class ImClasses { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public ImaClass[] Classes; } [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct ImaStruct { public byte A; } [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct ImStructs { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public ImaStruct[] Structs; } static void Main(string[] args) { int sizeofClasses = Marshal.SizeOf(typeof(ImClasses)); int sizeofStructs = Marshal.SizeOf(typeof(ImStructs)); Console.WriteLine("Class size: " + sizeofClasses); Console.WriteLine("Struct size: " + sizeofStructs); } } ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-dev] Symlinks not created
Hello, I'm new to Mono. I've tried to install it on OpenEmbedded/Angstrom using "opkg mono" but I got 4 warnings about symbolic links not created: * extract_archive: Cannot create symlink from ../gac/Mono.CompilerServices.SymbolWriter/2.0.0.0__0738eb9f132ed756/Mono.CompilerServices.SymbolWriter.dll to '../gac/Mono.CompilerServices.SymbolWriter/2.0.0.0__0738eb9f132ed756/Mono.CompilerServices.SymbolWrit': No such file or directory. * extract_archive: Cannot create symlink from ../gac/System.ComponentModel.DataAnnotations/3.5.0.0__31bf3856ad364e35/System.ComponentModel.DataAnnotations.dll to '../gac/System.ComponentModel.DataAnnotations/3.5.0.0__31bf3856ad364e35/System.ComponentModel.DataAnn': No such file or directory. * extract_archive: Cannot create symlink from ../gac/Mono.CompilerServices.SymbolWriter/1.0.5000.0__0738eb9f132ed756/Mono.CompilerServices.SymbolWriter.dll to '../gac/Mono.CompilerServices.SymbolWriter/1.0.5000.0__0738eb9f132ed756/Mono.CompilerServices.SymbolW': No such file or directory. * extract_archive: Cannot create symlink from ../gac/System.Runtime.Serialization.Formatters.Soap/1.0.5000.0__b03f5f7f11d50a3a/System.Runtime.Serialization.Formatters.Soap.dll to '../gac/System.Runtime.Serialization.Formatters.Soap/1.0.5000.0__b03f5f7f11d50a3a/System.Runtime.Seri': No such file or directory. It seems I'm hitting a 100 characters limit on the path name. I wanted to create the symbolic links myself: would that do the trick ? If yes, I'm not sure where exactly I need to create those symbolic links. After some browsing, here are the links I'm planning to create: * /usr/lib/mono/*2.0*/Mono.CompilerServices.SymbolWriter.dll -->/usr/lib/mono/gac/Mono.CompilerServices.SymbolWriter/*2.0*.../Mono.CompilerServices.SymbolWriter.dll * /usr/lib/mono/*2.0*/System.ComponentModel.DataAnnotations.dll -->/usr/lib/mono/gac/System.ComponentModel.DataAnnotations/*3.5*.../System.ComponentModel.DataAnnotations.dll * /usr/lib/mono/*1.0*/Mono.CompilerServices.SymbolWriter.dll -->/usr/lib/mono/gac/Mono.CompilerServices.SymbolWriter/*1.0*.../Mono.CompilerServices.SymbolWriter.dll * /usr/lib/mono/*1.0*/System.Runtime.Serialization.Formatters.Soap.dll -->/usr/lib/mono/gac/System.Runtime.Serialization.Formatters.Soap/*1.0*.../System.Runtime.Serialization.Formatters.Soap.dll Do I have these right ? Thanks for your help. ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Recent C# compiler changes
Hello, > I think both ways should be supported. > > If it starts with a number and is a valid constant, use it. (easier > for people building interactively in the command line), but for any > other pattern try to just concat as suggested (easier for makefiles > and to support custom frameworks) Yes, I'll implement it along these lines. Marek ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Recent C# compiler changes
I think both ways should be supported. If it starts with a number and is a valid constant, use it. (easier for people building interactively in the command line), but for any other pattern try to just concat as suggested (easier for makefiles and to support custom frameworks) Just my two cents, Rafael "Monoman" Teixeira --- "We live in a world operated by science and technology. We have also arranged things so that almost no one understands science and technology. This is a prescription for disaster. We might get away with it for a while, but sooner or later this combustible mixture of ignorance and power is going to blow up in our faces." -Carl Sagan On Thu, Feb 3, 2011 at 2:11 PM, Rodrigo B. de Oliveira wrote: > On Thu, Feb 3, 2011 at 2:06 PM, Miguel de Icaza wrote: >> ... >> Is it possible to instead of using a set of preconfigured numbers for >> the SDK, that we could provide a string, so that: >> >> -sdk:STRING >> >> Makes mcs look in $prefix/lib/mono/STRING >> >> That way we do not hardcode the constant, and we can have different >> profiles just by building that directory and invoking the compiler >> with that option. >> > > +1 > ___ > Mono-devel-list mailing list > Mono-devel-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-devel-list > ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Recent C# compiler changes
On Thu, Feb 3, 2011 at 2:06 PM, Miguel de Icaza wrote: > ... > Is it possible to instead of using a set of preconfigured numbers for > the SDK, that we could provide a string, so that: > > -sdk:STRING > > Makes mcs look in $prefix/lib/mono/STRING > > That way we do not hardcode the constant, and we can have different > profiles just by building that directory and invoking the compiler > with that option. > +1 ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Recent C# compiler changes
Hello Marek, > A new compiler option has been introduced called "sdk" with 2 values at > the moment (2, 4). It allows to build against predefined framework > version without manually specifying mscorlib location when compiling > directly using mcs compiler. The default value is 4. Although I mentioned this on IRC, I am not sure if you ever saw it. Is it possible to instead of using a set of preconfigured numbers for the SDK, that we could provide a string, so that: -sdk:STRING Makes mcs look in $prefix/lib/mono/STRING That way we do not hardcode the constant, and we can have different profiles just by building that directory and invoking the compiler with that option. Miguel ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Recent C# compiler changes
Hello, >> install mono including .net 4.0 support to be able to compile any C# >> program. > What's the lowest Mono version that can be used to bootstrap > the current git version? I have not really tested it but Mono 2.4 or newer should work. Marek ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Recent C# compiler changes
Marek, On 03.02.2011 13:48, Marek Safar wrote: > On top of that mcs.exe is now .net 4 application which means you need to > install mono including .net 4.0 support to be able to compile any C# > program. What's the lowest Mono version that can be used to bootstrap the current git version? Robert ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-dev] Recent C# compiler changes
Hello, In the recent weeks I have made several changes to how Mono C# compiler is build and works. With the current master version we no longer use and build System.Reflection based C# compilers (gmcs.exe, smcs.exe, dmcs.exe). The new C# compiler (called mcs.exe) is based on IKVM.Reflection which allows us to build mscorlib independent version of C# compiler. The compiler scripts (gmcs, dmcs) are still working just internally call different program. A new compiler option has been introduced called "sdk" with 2 values at the moment (2, 4). It allows to build against predefined framework version without manually specifying mscorlib location when compiling directly using mcs compiler. The default value is 4. On top of that mcs.exe is now .net 4 application which means you need to install mono including .net 4.0 support to be able to compile any C# program. All changes apply to mono master only and will be part of the following Mono's release after 2.10. Marek ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list