I'm converting a function from Visual Basic 6.0 as:
Declare Function RequestOperation Lib "archivedll" (ByVal dth As Long, ByVal searchRequestBuf As String, ByVal buflen As Long, ByVal FieldNum As Long, ByVal OP As Long, ByVal value As String) As Long
In C#, I'm declare the function as:
[DllImport("archivedll")]
public static extern int RequestOperation(int dth ,StringBuilder searchRequestBuf, int bufferLen, int fieldNum, int op, string value);
When call RequestOperation from C#, it throws an exception:
[System.AccessViolationException] = {"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."}
I have successful in calling many other functions like this, but only this function throws the exception.