Google's WebP encoderのC#ラッパーを記述しようとしています。呼び出そうとこのWebP C++関数の正しいC#PInvoke署名
方法イムはされています。私はこれを実行しようとする時はいつでも残念ながら、私は次のエラーを取得する
[DllImport("libwebp", CharSet = CharSet.Auto)]
public static extern IntPtr WebPEncodeRGB(IntPtr data, int width, int height, int stride, float quality, ref IntPtr output);
:私は次のように出ているmc-kay's decoder wrapperから
// Returns the size of the compressed data (pointed to by *output), or 0 if
// an error occurred. The compressed data must be released by the caller
// using the call 'free(*output)'.
WEBP_EXTERN(size_t) WebPEncodeRGB(const uint8_t* rgb,
int width, int height, int stride,
float quality_factor, uint8_t** output);
借入:
A call to PInvoke function 'WebPSharpLib!LibwebpSharp.Native.WebPEncoder::WebPEncodeRGB' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
私は署名に多くの変形を試みましたl。
誰かが手掛かりを得ましたか?
乾杯、 マイク・エラーのため
最後の 'IntPtr'パラメータで' ref'を削除します。 – JaredPar
@ JaredPar:いいえ、しないでください。それは二重ポインタです。 – SLaks
C++の 'int'sのサイズはどれくらいですか? – SLaks