https://bugzilla.novell.com/show_bug.cgi?id=469217

User [email protected] added comment
https://bugzilla.novell.com/show_bug.cgi?id=469217#c2





--- Comment #2 from Eugeny Grishul <[email protected]>  2009-01-25 
11:18:50 MST ---
I found ability to pass pointers in Mono docs:
http://www.mono-project.com/Interop_with_Native_Libraries

 struct Item {
    [DllImport ("library")]
    public static unsafe extern 
       bool CreateItem (out Item* item);

    [DllImport ("library")]
    public static unsafe extern void DestroyItem (Item* item);

    [DllImport ("library")]
    public static unsafe extern int GetInfo (Item* item);
 }


I provide more clear example(tested on MS .NET 3.5+SP1):

using System.Runtime.InteropServices;

namespace MonoTest
{
    unsafe class Program
    {
        static void Main( string[] args )
        {
            printf( ( SomeStruct* ) Marshal.StringToHGlobalAnsi( "this text
appears only in MS.NET VES!\r\n" ).ToPointer() );
        }

        unsafe struct SomeStruct
        {
            public System.IntPtr _ptr;
        }

        [DllImport( "msvcrt.dll" )]
        static extern void printf( SomeStruct* arr );
    }
}

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to