I have written a code in C# to load functions in an unmanaged dll.
This is the code.
static unsafe void Main(string args)
deviceNr = 0;
Info = null;
intMyReturnVal = sample_getinfo(deviceNr, Info);
private unsafe static extern int sample_getinfo(int deviceNr, char* Info);
and this is the API function description by dll supllier.
Sample_GetInfo (int deviceNr,
deviceNr is a number of found card in system
Info is handler for string with information about current card in system
Returns 0 (zero) when success. Otherwise return an error code.
This function provide information about installed card in system. Information returned
in Info string looks like below:
„SN YY.SN rev. RRR", where:
YY – year of production
SN – serial number
RRR – firmware revision
The problem is that when I run this code I get the bellow error exception:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
I have written this in VB.net to and get the same result.
I would appreciate your help.