Hi all,
I am using DllImport to invoke an external C dll's function.
C header file has the following definition
_EASY_IMPORT_OR_EXPORT_ eint EASYCALL setSessionElement(eint SessionId, PCSTR lpszElementName, PCSTR lpszElementValue)
C# import statement
[DllImport("EasyclaimC.dll", CharSet = CharSet.Auto, EntryPoint = "setSessionElement", CallingConvention = CallingConvention.StdCall, SetLastError = true)]
public static extern long setSessionElement(
long SessionId,
[MarshalAs(UnmanagedType.LPWStr)]
string ElementName,
[MarshalAs(UnmanagedType.LPWStr)]
string ElementValue);
Invoke:
ECAPI.setSessionElement(aSessionId,"LocationID", minorCustId);
which fails with the "attempted to read or write protected memory error"
Is the dll import signature correct? Please throw some light on this. Thanks
Maithili
statusCode =