I have a problem with marshalling SSL_ctrl func from OpenSsl 1.0.2 beta.
This func is
long SSL_ctrl(SSL *ctx, int cmd, long larg, void *parg);
I'm trying to marshal it as
[DllImport(SSLDLLNAME, CallingConvention = CallingConvention.Cdecl)]
public static extern long SSL_ctrl(IntPtr /* SSL* */ ssl,
int cmd,
long larg,
IntPtr parg);
I've enabled native code debugging in my Visual Studio.
The problem is the last argument.
I've tried to call that func with different pointers (non zero) but result is always same:
native code accepts parg, but parg is equal to 0x0
.
I've tried to pass strings (got pointer by calling Marshal.StringToHGlobalAnsi(serverName)),
tried to pass some generated non-zero pointer, but the result is always same. parg is 0x0 in the native code.
Could you please help me with that issue?