+2003-02-26 Zoltan Varga <vargaz@freemail.hu>
+
+ * TypeBuilder.cs (DefineInitializedData): Removed unnecessary assignments.
+
+ * ModuleBuilder.cs (DefineInitializedData): Do not call
+ TypeBuilder::DefineInitializedData since that would mean defining a
+ nested type of the global type, which is wrong. Instead define a
+ new public type as MS does.
+
+ * ModuleBuilder.cs (DefineUninitializedData): Ditto.
Thu Feb 13 18:40:52 CET 2003 Paolo Molaro <lupus@ximian.com>
global_type_created = global_type.CreateType ();
}
+ // Same as under MS.NET
+ static int GlobalDataCount = 10000;
public FieldBuilder DefineInitializedData( string name, byte[] data, FieldAttributes attributes) {
if (name == null)
if (global_type == null)
global_type = new TypeBuilder (this, 0);
- FieldBuilder fb = global_type.DefineInitializedData (name, data, attributes);
+ TypeBuilder datablobtype = DefineType (
+ "$ArrayType$" + GlobalDataCount.ToString(),
+ TypeAttributes.Public|TypeAttributes.ExplicitLayout|TypeAttributes.Sealed,
+ assemblyb.corlib_value_type, null, PackingSize.Size1, data.Length);
+ datablobtype.CreateType ();
+ GlobalDataCount ++;
+ FieldBuilder fb = global_type.DefineField (name, datablobtype, attributes|FieldAttributes.Assembly|FieldAttributes.Static|FieldAttributes.HasFieldRVA);
+ fb.SetRVAData (data);
if (global_fields != null) {
FieldBuilder[] new_fields = new FieldBuilder [global_fields.Length+1];
if (global_type == null)
global_type = new TypeBuilder (this, 0);
- FieldBuilder fb = global_type.DefineUninitializedData (name, size, attributes);
+ TypeBuilder datablobtype = DefineType (
+ "$ArrayType$" + GlobalDataCount.ToString(),
+ TypeAttributes.Public|TypeAttributes.ExplicitLayout|TypeAttributes.Sealed,
+ assemblyb.corlib_value_type, null, PackingSize.Size1, size);
+ datablobtype.CreateType ();
+ GlobalDataCount ++;
+ throw new NotImplementedException ();
+
+ /*
if (global_fields != null) {
FieldBuilder[] new_fields = new FieldBuilder [global_fields.Length+1];
System.Array.Copy (global_fields, new_fields, global_fields.Length);
global_fields [0] = fb;
}
return fb;
+ */
}
public MethodBuilder DefineGlobalMethod (string name, MethodAttributes attributes, Type returnType, Type[] parameterTypes)
TypeBuilder datablobtype = DefineNestedType ("$ArrayType$"+InitializedDataCount.ToString(),
TypeAttributes.NestedPrivate|TypeAttributes.ExplicitLayout|TypeAttributes.Sealed,
pmodule.assemblyb.corlib_value_type, null, PackingSize.Size1, data.Length);
- datablobtype.packing_size = PackingSize.Size1;
- datablobtype.class_size = data.Length;
datablobtype.CreateType ();
FieldBuilder res = DefineField (name, datablobtype, attributes|FieldAttributes.Assembly|FieldAttributes.Static|FieldAttributes.HasFieldRVA);
res.SetRVAData (data);