I'm interfacing with a native 3rd party C++ DLL via C# and the provided interop layer looks like below:
C#:
[DllImport("csvcomm.dll")]
public static extern int CSVC_ValidateCertificate(byte[] certDER, int length);
C++:
CSVC_Status_t CSVCOMM_API CSVC_ValidateCertificate(BYTE* certDER, DWORD length,
DWORD context = CONTEXT_DEFAULT);
Note, there are only two parameters in the C# extern definition since the the C++ function provides a default value for the third parameter. Is this correct? I was receiving some non-deterministic results when using the provided definition, but when I added the third parameter like below, it seems to be working correctly each time rather than sporadically.
[DllImport("csvcomm.dll")]
public static extern int CSVC_ValidateCertificate(byte[] certDER, int length,
int context);
Any ideas? Would the addition of the 3rd parameter really fix this issue?