X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Ftests%2Fpinvoke2.cs;h=826b91e1f8f7d4b38f48a062cf624f18b42ed516;hb=989100d5f0a5e7f4f62f2580b43921444d45ce60;hp=41d9fe7c0efb4e2f7fabd65dd17debe8de601de5;hpb=f8f2da07c9b0a609f07aa342b49e4dcb7f6bf6b4;p=mono.git diff --git a/mono/tests/pinvoke2.cs b/mono/tests/pinvoke2.cs index 41d9fe7c0ef..826b91e1f8f 100644 --- a/mono/tests/pinvoke2.cs +++ b/mono/tests/pinvoke2.cs @@ -1,3 +1,7 @@ +// +// Copyright 2011 Xamarin Inc (http://www.xamarin.com). +// + using System; using System.Text; using System.Runtime.InteropServices; @@ -1642,5 +1646,55 @@ public class Tests { else return 2; } + + [DllImport ("libtest", EntryPoint="mono_test_marshal_lpstr")] + public static extern int mono_test_marshal_lpstr ([MarshalAs(UnmanagedType.LPStr)] string str); + + public static int test_0_mono_test_marshal_lpstr () { + string str = "ABC"; + + if (mono_test_marshal_lpstr (str) != 0) + return 1; + + return 0; + } + + [DllImport ("libtest", EntryPoint="mono_test_marshal_lpwstr")] + public static extern int mono_test_marshal_lpwstr ([MarshalAs(UnmanagedType.LPWStr)] string str); + + public static int test_0_mono_test_marshal_lpwstr () { + string str = "ABC"; + + if (mono_test_marshal_lpwstr (str) != 0) + return 1; + + return 0; + } + + + [method: DllImport ("libtest", EntryPoint="mono_test_marshal_return_lpstr")] + [return: MarshalAs(UnmanagedType.LPStr)] + public static extern string mono_test_marshal_return_lpstr (); + + public static int test_0_mono_test_marshal_return_lpstr () { + string str = mono_test_marshal_return_lpstr (); + if ("XYZ" == str) + return 0; + + return 1; + } + + [method: DllImport ("libtest", EntryPoint="mono_test_marshal_return_lpwstr")] + [return: MarshalAs(UnmanagedType.LPWStr)] + public static extern string mono_test_marshal_return_lpwstr (); + + public static int test_0_mono_test_marshal_return_lpwstr () { + string str = mono_test_marshal_return_lpwstr (); + if ("XYZ" == str) + return 0; + + return 1; + } + }