2 using System.Runtime.InteropServices;
6 [DllImport ("libtest", EntryPoint="mono_test_byvalstr_gen")]
7 public static extern IntPtr mono_test_byvalstr_gen();
9 [DllImport ("libtest", EntryPoint="mono_test_byvalstr_check")]
10 public static extern int mono_test_byvalstr_check(IntPtr data, string correctString);
12 [StructLayout (LayoutKind.Sequential)]
13 public struct ByValStrStruct
15 [MarshalAs(UnmanagedType.ByValTStr, SizeConst=100)]
19 public unsafe static int Main ()
21 string testString = "A small string";
23 IntPtr udata = mono_test_byvalstr_gen();
25 ByValStrStruct data = new ByValStrStruct();
28 Marshal.StructureToPtr(data, udata, false);
30 return mono_test_byvalstr_check(udata, testString);