HI,
we are using one c++ dll to read data from Hardware. Following is the function defination from C++ dll.
LRESULT CALLBACK MT_Read_Holding_Reg(long llSocketHandle,UCHAR lucDevID,USHORT lunAddress,USHORT lunQuantity, USHORT* lunHLData);
To Call this from C# I have written following code:
[DllImport("MT_TCP_Read.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int MT_Read_Input_Reg(int llSocketHandle, byte lucDevID, short lunAddress, short lunQuantity, ref short lunHLData);
and while calling this function I have writtten following code:
short[] arr_hg = new short[3];
int ret = -1;
ret = MT_Read_Coils(handle, 1, 100, 3, ref arr_coils[0]);
This function return no data where as same dll used in VB6 return correct data.
Is there any problem in above code.
Any help appreciated.
Regards,
Vikram
Loading
Sam HobbsPosted Apr 12, 2012, 2:50 PM
VulpesPosted Apr 12, 2012, 12:13 PM