I have a C# program going and want to be able to call the DLL and receive back the data requested through a pointer.
Below is the DLL import within my C# code.
Below is the code in the DLL
public static extern int ReadNetwork(Byte ROM_ID);
And below how I'mm calling the DLL and trying to print out the results.
int _stdcall ReadNetwork(unsigned char* Array1)
for(i = 0; i < 20; i++)
Array1[i] = readBackArray[i];
I've tried changing the return values in the DLL's ReadNetwork() function and that works ok, so I know I'm calling the DLL and it runs ok, but printing the result back is where I'm having the problem. Any help will be appreciated.
testArray = new byte;
errorCheck = ReadNetwork(testArray);
MessageBox.Show("Return Value: " + errorCheck.ToString());
value = ASCIIEncoding.ASCII.GetString(testArray);
MessageBox.Show("Array String: " + value);