i have one 'C' 'DLL' which can take structures as input, i have to call that dll from my c# program
fallowing are the sample structures i have in c, i have to marshal those structures in my c# code
is i'm doing correct or wrong?
Actual C structures:
typedef struct procedure
{
char code[8];
}procedure;
typedef struct datefield
{
char date[10];
}datefield;
typedef struct p45_clsgs
{
procedure p45_clsg;
datefield p45_clsgdte;
}p45_clsgs;
C#:
[StructLayout(LayoutKind.Sequential), Serializable]
struct procedure
{
//char code[];
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 8)]
public string code;
}
[StructLayout(LayoutKind.Sequential), Serializable]
struct datefield
{
//char date[10];
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 10)]
public string date;
}
struct p45_clsgs
{
public procedure p45_clsg;
public datefield p45_clsgdte;
}
Is my C# structs are correct for the C structs?
What is the equivalent C# structure for the fallowing c structure
typedef struct p45_cldxed24
{
procedure p45_cldxed[8];
}p45_cldxed24;