See the question and my original answer on StackOverflow

From official documentation here: there is a C++ definition, plus a bit of documentation on what the second parameter is, which is really what you want to look at:

VC++: (see E5KDAQ.h)

unsigned short E5K_ReadDIStatus (int id, unsigned long *Didata);


id: module ID address

Didata: points to a 32-bit buffer to store DI status

So the C# definition should simply be (long and int in C++ are 32-bit)

static extern ushort E5K_ReadDIStatus(int id, ref uint Didata)