From Friday, January 17th 11 PM CDT (January 18th 5 AM UTC) through Saturday, January 18th 11:30 AM CDT (January 18th 5:30 PM UTC), ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

how to set DLLImport for the NI845x.dll ? Calls dont work

Have the NI USB8452 DIO/SPI/I2C box.  Example code in labview and C

 

My app is C sharp 8.0 winforms

 

 

Unmanaged C will not run in C# since its a managed environment.  The workaround is to use DLLImport

Find Device?  works 

 

 

try
{
int x = ni845xFindDevice(FirstDevice, out device, out numdevices);

 

..

..

..


[DllImport("Ni845x.dll", CallingConvention = CallingConvention.StdCall)]
public static extern Int32 ni845xFindDevice(
[MarshalAs(UnmanagedType.LPArray)] byte[] firstDevice,
out NiHandle findDeviceHandle,
out UInt32 numberFound
);

 

most other calls do not work, it does not send anything out.  Taking a script that runs and putting the statements into this C# app there is no output from the NI 845x unit.

 

Someone must have made this dll wrapper for C# at some point?

0 Kudos
Message 1 of 1
(240 Views)