[Mono-dev] Marshaling Question

Scott Peterson lunchtimemama at gmail.com
Sat Feb 9 04:06:58 EST 2008


I need to marshal the native cdrom_tocentry struct from linux/cdrom.h
(http://www.gelato.unsw.edu.au/lxr/source/include/linux/cdrom.h#L218).
Here's my attempt (which is incorrect). Can someone tell me where I'm
going wrong?

[StructLayout(LayoutKind.Explicit)]
struct cdrom_tocentry
{
    [FieldOffset(0)]
    public byte cdte_track;
    [FieldOffset(1)]
    public byte cdte_adr;
    [FieldOffset(5)]
    public byte cdte_ctrl;
    [FieldOffset(9)]
    public byte cdte_format;
    [FieldOffset(10)]
    public cdrom_addr cdte_addr;
    [FieldOffset(14)]
    public byte cdte_datamode;
}

[StructLayout(LayoutKind.Explicit)]
struct cdrom_addr
{
    [FieldOffset(0)] public cdrom_msf0 msf;
    [FieldOffset(0)] public int lba;
}

[StructLayout(LayoutKind.Sequential)]
struct cdrom_msf0
{
    public byte minute;
    public byte second;
    public byte frame;
}

-- 
Scott.


More information about the Mono-devel-list mailing list