Passing bitmap from C# to C++ via a struct
There is not much to review. The only thing I can contribute with is that you don't have to run in unsafe mode:

If you define the data structure as:

  [StructLayout(LayoutKind.Sequential)]
  internal struct RawImage
  {
    internal IntPtr ImageData;
    internal int Size;
  }


Then you can run the .NET side as:

  using (var bitmap = new Bitmap(@"fileName.Jpeg"))
  using (var stream = new MemoryStream())
  {
    bitmap.Save(stream, ImageFormat.Jpeg);
    var source = stream.ToArray();

    IntPtr handle = IntPtr.Zero;

    try
    {
      handle = Marshal.AllocHGlobal(source.Length);
      Marshal.Copy(source, 0, handle, source.Length);

      var raw = new RawImage
      {
        ImageData = handle,
        Size = source.Length
      };
      submit(raw);
    }
    catch (Exception ex)
    {
      if (handle != IntPtr.Zero)
      {
        Marshal.FreeHGlobal(handle);
      }
    }
  }


The above works with the same signature for submit(RawImage img).

It's a little more code, but you are not limiting the use of your module.