using System.Reflection.Emit;
using System.Globalization;
using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
namespace System.Reflection.Emit {
public class ParameterBuilder {
private MethodBase methodb; /* MethodBuilder or ConstructorBuilder */
private string name;
private CustomAttributeBuilder[] cattrs;
+ private UnmanagedMarshal marshal_info;
private ParameterAttributes attrs;
private int position;
private int table_idx;
position = pos;
attrs = attributes;
methodb = mb;
- table_idx = mb.get_next_table_index (0x08, true);
+ table_idx = mb.get_next_table_index (this, 0x08, true);
}
public virtual int Attributes {
}
public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ string attrname = customBuilder.Ctor.ReflectedType.FullName;
+ if (attrname == "System.Runtime.InteropServices.InAttribute") {
+ attrs |= ParameterAttributes.In;
+ return;
+ } else if (attrname == "System.Runtime.InteropServices.OutAttribute") {
+ attrs |= ParameterAttributes.Out;
+ return;
+ } else if (attrname == "System.Runtime.InteropServices.OptionalAttribute") {
+ attrs |= ParameterAttributes.Optional;
+ return;
+ } else if (attrname == "System.Runtime.InteropServices.MarshalAsAttribute") {
+ marshal_info = CustomAttributeBuilder.get_umarshal (customBuilder, true);
+ /* FIXME: check for errors */
+ return;
+ }
if (cattrs != null) {
CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
cattrs.CopyTo (new_array, 0);
public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
}
+
public virtual void SetMarshal( UnmanagedMarshal unmanagedMarshal) {
+ marshal_info = unmanagedMarshal;
+ attrs |= ParameterAttributes.HasFieldMarshal;
}
-
-
-
-
}
}