I am trying to write a wrapper library for MIDI functions in WinMM.dll, but I am having trouble with MIDI long messages. I found this in PIvnoke.net (I added the first line myself):
[StructLayout(LayoutKind.Sequential)]
public struct MIDIHDR
{
IntPtr lpData;
int dwBufferLength;
int dwBytesRecorded;
IntPtr dwUser;
int dwFlags;
MIDIHDR lpNext;
IntPtr reserved;
int dwOffset;
IntPtr dwReserved;
}
But I get an error while compiling:
Error 1 Struct member 'WinMMM.MidiWrapper.MIDIHDR.lpNext' of type 'WinMMM.MidiWrapper.MIDIHDR' causes a cycle in the struct layout C:\Users\Alex\Documents\Visual Studio 2010\Projects\WinMMM\WinMMM\MidiWrapper.cs 219 21 WinMMM
I am using Visual Studio Ultimate 2010, I am making a C# class library, and any help will be appreciated!