[Mono-bugs] [Bug 25360] New - Implement more methods in Marshal class
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
28 May 2002 01:33:13 -0000
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by danmorg@sc.rr.com.
http://bugzilla.ximian.com/show_bug.cgi?id=25360
--- shadow/25360 Mon May 27 21:33:13 2002
+++ shadow/25360.tmp.18676 Mon May 27 21:33:13 2002
@@ -0,0 +1,69 @@
+Bug#: 25360
+Product: Mono/Class Libraries
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: danmorg@sc.rr.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Implement more methods in Marshal class
+
+In corlib.dll, I would like to have more methods in class
+System.Runtime.InteropServices.Marshal to be implemented.
+I'm not sure of all the classes I will need, but I can tell you some.
+
+The Marshal class is not completely stubbed out either, so it is hard to
+see what needs to be worked on. Will most of the Marshal class be
+implemented in icalls?
+
+1. PtrToStringAnsi().
+=====================
+This is a PtrToStringAuto() that uses an icall and can be found
+in /mono/metadata/icall.c as
+
+static MonoString*
+ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAuto
+(gpointer ptr)
+
+I suppose this could be used as a base for PtrToStringAnsi.
+In the meantime, I substitute PtrToStringAuto() for PtrToStringAnsi().
+
+2. PtrToStructure.
+==================
+This is how it is being used:
+Field fd = (Field) Marshal.PtrToStructure(MySql.FetchField(res), typeof
+(Field));
+
+Here is the definition for the Field class:
+[StructLayout(LayoutKind.Sequential)]
+public class Field {
+///<value>name of column</value>
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string Name;
+ ///<value>table of column</value>
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string Table;
+ ///<value>default value</value>
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string Def;
+ ///<value>type of field</value>
+ public int FieldTypes;
+ ///<value>width of column</value>
+ public uint Length;
+ ///<value>max width of selected set</value>
+ public uint MaxLength;
+ ///<value>div flags</value>
+ public uint Flags;
+ ///<value>number of decimals in field</value>
+ public uint Decimals;
+}
+
+Note, this code is based on code that works on ms.net.