Structure in C DLL
----------------------------
typedef struct IrData
{
unsigned short uiFormat;
unsigned short uiLength;
unsigned char* pchData;
} tagIrData;
Function in C DLL
----------------------------
short ConvertData(cha r* pchString, tagIrData* ptIrCode); ---This
function fills the allocated structure with the respective field
values.
How should we write the PInvoke for this ? I have tried the method
below (with both struct & class) but my structure elements go for a
toss. Please correct me.
[StructLayout(La youtKind.Sequen tial)]
internal class IrData
{
public ushort IrFormat;
public ushort IrCodeLength;
public byte[] IrCodeData;
}
[DllImport("Some Dll.dll")]
private static extern short ConvertData(str ing strData, IrData
data);
Thx in Advance.