Actually the question is: how can I transfer an image (Bitmap) From a program written in C # to the C ++ library. Thanks in advance for your answers.

  • one
    The key word is marshaling. Look at any wrappers for C / C ++ libraries, for example curl . - NewView 5:41 pm

1 answer 1

Like this, the declaration of a foreign function :) on C #

  public class NativeMethods { [DllImport("mylib_dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] // если возвращает bool/int/long.. [return: MarshalAs(UnmanagedType.Bool)] public static extern IntPtr myfunc(IntPtr mybitmap, int sizeOfBitmap); } 

Use this:

  var aaa = NativeMethods.myfunc(bitmapBytes, bitmapBytes.length);