G
Guest
I have an unmanaged DLL, which includes the following struct :
typedef struct TB_Board_Inf
{
char BoardOwner[20];
WORD BoardId;
BYTE BoardRev; //A,B,C...
} TB_Board_Info_struct;
and the following API :
TB_Board_Info_struct *iTB_BoardInformationBlock_Read( void );
int iTB_BoardInformationBlock_Update(TB_Board_Info_struct *mmBInfo);
in my C# I define the update function as following :
[DllImport("TebInterface.dll",
EntryPoint="iTB_BoardInformationBlock_Update",SetLastError=true,
CharSet=CharSet.Ansi, ExactSpelling=true,
CallingConvention=CallingConvention.StdCall)]
public static extern int iTB_BoardInformationBlock_Update(ref
TB_Board_Info_struct mmBInfo);
But I don't know how to define the Read , since I got an error in 'ref' :
[DllImport("TebInterface.dll",
EntryPoint="iTB_BoardInformationBlock_Read",SetLastError=true,
CharSet=CharSet.Ansi, ExactSpelling=true,
CallingConvention=CallingConvention.StdCall)]
public static extern ref TB_Board_Info_struct
iTB_BoardInformationBlock_Read();
How to define the Read ? I also define the structure as :
[ StructLayout( LayoutKind.Sequential ,CharSet = CharSet.Ansi)]
public struct TB_Board_InformationBlock_struct
{
public IntPtr BoardOwner ; //MAX = 20
public Int16 BoardId;
public byte BoardRev; //A,B,C...
}
Regards,
Yosef
typedef struct TB_Board_Inf
{
char BoardOwner[20];
WORD BoardId;
BYTE BoardRev; //A,B,C...
} TB_Board_Info_struct;
and the following API :
TB_Board_Info_struct *iTB_BoardInformationBlock_Read( void );
int iTB_BoardInformationBlock_Update(TB_Board_Info_struct *mmBInfo);
in my C# I define the update function as following :
[DllImport("TebInterface.dll",
EntryPoint="iTB_BoardInformationBlock_Update",SetLastError=true,
CharSet=CharSet.Ansi, ExactSpelling=true,
CallingConvention=CallingConvention.StdCall)]
public static extern int iTB_BoardInformationBlock_Update(ref
TB_Board_Info_struct mmBInfo);
But I don't know how to define the Read , since I got an error in 'ref' :
[DllImport("TebInterface.dll",
EntryPoint="iTB_BoardInformationBlock_Read",SetLastError=true,
CharSet=CharSet.Ansi, ExactSpelling=true,
CallingConvention=CallingConvention.StdCall)]
public static extern ref TB_Board_Info_struct
iTB_BoardInformationBlock_Read();
How to define the Read ? I also define the structure as :
[ StructLayout( LayoutKind.Sequential ,CharSet = CharSet.Ansi)]
public struct TB_Board_InformationBlock_struct
{
public IntPtr BoardOwner ; //MAX = 20
public Int16 BoardId;
public byte BoardRev; //A,B,C...
}
Regards,
Yosef