:wave: Hi ; I would like to "copy a pointer with i...
# kotlin-native
f
👋 Hi ; I would like to "copy a pointer with it's data". I didn't find a way... at least i'm not sure =/ Here is an existing C code :
Copy code
MAGICK_NATIVE_EXPORT PixelInfo *MagickColor_Clone(const PixelInfo *color)
{
  PixelInfo
    *pixel_info;

  if (color == (PixelInfo *) NULL)
    return (PixelInfo *) NULL;

  pixel_info = (PixelInfo *) AcquireMagickMemory(sizeof(*pixel_info));
  if (pixel_info == (PixelInfo *) NULL)
    return (PixelInfo *) NULL;

  *pixel_info = *color;
  return pixel_info;
}
I found on this stackoverflow thread that
*pixel_info = *color;
is called data pointed to by pointers ; I can't do something like this in Kotlin Native:
pixel_info.pointer = color.pointer
I found on this other thread that i could use
memcpy
explicitly. What is the "right way" to do it? Thanks, Regards.