A
angshuman.agarwal
Structure in C DLL
----------------------------
typedef struct IrData
{
unsigned short uiFormat;
unsigned short uiLength;
unsigned char* pchData;
} tagIrData;
Function in C DLL
----------------------------
short ConvertData(char* 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(LayoutKind.Sequential)]
internal class IrData
{
public ushort IrFormat;
public ushort IrCodeLength;
public byte[] IrCodeData;
}
[DllImport("SomeDll.dll")]
private static extern short ConvertData(string strData, IrData
data);
Thx in Advance.
----------------------------
typedef struct IrData
{
unsigned short uiFormat;
unsigned short uiLength;
unsigned char* pchData;
} tagIrData;
Function in C DLL
----------------------------
short ConvertData(char* 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(LayoutKind.Sequential)]
internal class IrData
{
public ushort IrFormat;
public ushort IrCodeLength;
public byte[] IrCodeData;
}
[DllImport("SomeDll.dll")]
private static extern short ConvertData(string strData, IrData
data);
Thx in Advance.