У меня проблема, странная.Когда я использую следующую структуру в PInvoke, она работает, но когда я изменяю ее на класс, она не работает.
мой c #:
[StructLayout(LayoutKind.Sequential)]
public struct SPInvokeImage
{
public int m_BitsPerPixel; // 8,16,24,32
public int m_ImageHeight;
public int m_ImageWidth;
public int m_BytesArraySize; // array size in bytes.
public IntPtr m_pArray; //data array
}
c ++
typedef struct
{
int mBitsPerPixel; // 8,16,24,32
int mImageHeight;
int mImageWidth;
int BytesArraySize; // array size in bytes.
uint8_t *Array; //data array
}SPInvokeImage;
, когда я изменяю c # на это, он перестает работать:
[StructLayout(LayoutKind.Sequential)]
public class SPInvokeImage
{
public int m_BitsPerPixel; // 8,16,24,32
public int m_ImageHeight;
public int m_ImageWidth;
public int m_BytesArraySize; // array size in bytes.
public IntPtr m_pArray; //data array
}