[Gtk-sharp-list] Marshaling question

Charles Iliya Krempeaux charles@reptile.ca
27 Feb 2003 10:13:54 -0800


Hello,

OK, I can't seem to find any good documentation on this,
so I'll just ask the question.  (If anyone does know of
any good documentation on this, then please let me know.)


I am creating C# a method with the following signature:

   public override int Read(byte[] buffer, int offset, int count);

Here, "buffer" (will eventually) contain the stuff that got read.  
"offset" tells you where to start storing stuff in "buffer".
("offset" used a zero based index.)  And "count" is the maximun
number of bytes to read from the current stream.  Also, it returns
the total number of bytes read from the stream.

Now, I'm using this to wrap the GnomeVFS procedure:

  GnomeVFSResult gnome_vfs_read(GnomeVFSHandle   *handle      ,
                                gpointer          buffer      ,
                                GnomeVFSFileSize  bytes       ,
                                GnomeVFSFileSize *bytes_read );

The problem I am having is with "buffer" in "gnome_vfs_read".  I
need to get a the get at the pointer for "Read"'s buffer.  In
pseudo code, this is basically what I want to do...

    public override int Read(byte[] buffer, int offset, int count)
    {

        byte * bufferptr = (byte * ) buffer;

        bufferptr = bufferptr + offset;

        // ...

Although, I am not sure how to do this.  Anyone here have any
ideas?

(I.e., anyone know how to get a pointer to "buffer"'s memory
buffer?)


See ya

-- 
     Charles Iliya Krempeaux, BSc
     charles@reptile.ca

________________________________________________________________________
 Reptile Consulting & Services    604-REPTILE    http://www.reptile.ca/