I interact with a native third-party C ++ DLL through C #, and the provided interaction layer is as follows:
WITH#:
[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 extern C # definition, since the C ++ function provides a default value for the third parameter. It's right? I got some non-deterministic results when using the provided definition, but when I added the third parameter, as shown below, it works correctly every time, and not sporadically.
[DllImport("csvcomm.dll")]
public static extern int CSVC_ValidateCertificate(byte[] certDER, int length,
int context);
Any ideas? Will adding a third parameter really fix this problem?
source
share