Hello,
I need to communicate with NI device (USB 8451). Since all our code base is in .NET, in order to commuinicate with that device, I tried to create a wrapper class in .NET to call the native ni845x.dll.
I have followed the documentation give at "C:\Program Files\National Instruments\NI-845x\MS Visual C\ni845x.h"
kNI845XExport int32 NI845X_FUNC ni845xFindDevice (
char * FirstDevice,
NiHandle * FindDeviceHandle,
uInt32 * NumberFound
);
After converting the above function in MS Visual C to C# and calling that method crashes whole application.
int pInvokeResult = PInvoke.FindDevice(out this.Resource_Name, out this._handle, out this.NumberFound);
[DllImport("Ni845x.dll", EntryPoint = "ni845xFindDevice", CallingConvention = CallingConvention.StdCall)]
public static extern int FindDevice(out string FirstDevice, out System.IntPtr Instrument_Handle, out System.UInt32 NumberFound);
Is there any way I can solve this problem? MAX is able to identify and communicate without any problem.
It would be great if you could guide me to solve this problem.
Regards,
Suresh