DLLENTRY int CCON mfScan (int, int, int, char *, int *);
[DllImport("mflib.dll")]
public static extern int mfScan(int mode, int font, int timeout, string ret_codeline, int ret_maxchars);
I get the below error with this code. It points to test. What can i do ?
string test = string.Empty;
int retval = mfScan(32, 2, 5000, test, 100);
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Try with this:
Please note the
StringBuilderinstead of string, additionally to theout int ret_maxchars.Then ensure the calling convention is correct.