<div dir="ltr">Hello,<div><br></div><div>I'm struggling with binding libgphoto2. The function: <a href="http://www.gphoto.org/doc/api/gphoto2-camera_8h.html#aa22be0b9b3018082174d0f7c8ecd2e26" target="_blank">gp_camera_get_storageinfo</a> puts the resulting structures in an array and therefore its argument is: `CameraStorageInformation**`. </div><div><br></div><div>I've mapped the structure in following way:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div>(define _CameraStorageInfoFields (_enum '(gp_storageinfo_base gp_storageinfo_label))) ; not all mapped</div></div><div><div>(define _CameraStorageType (_enum '(gp_storageinfo_st_unknown gp_storageinfo_st_fixed_rom))) ; not all mapped</div></div><div><div>(define _CameraStorageFilesystemType (_enum '(gp_storageinfo_fst_undefined))) ; not all mapped</div></div><div><div>(define _CameraStorageAccessType (_enum '(gp_storageinfo_ac_readwrite))) ; not all mapped</div></div><div><div><br></div></div><div><div>(define-cstruct _CameraStorageInformation</div></div><div><div>  ([fields _CameraStorageInfoFields]</div></div><div><div>   [basedir (_array/list _byte 256)]</div></div><div><div>   [label (_array/list _byte 256)]</div></div><div><div>   [description (_array/list _byte 256)]</div></div><div><div>   [type _CameraStorageType]</div></div><div><div>   [fstype _CameraStorageFilesystemType]</div></div><div><div>   [access _CameraStorageAccessType]</div></div><div><div>   [capacitykbytes _uint64]</div></div><div><div>   [freekbytes _uint64]</div></div><div><div>   [freeimages _uint64]))</div></div></blockquote><div><br></div><div>And said function:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div>(define-gphoto gp_camera_get_storageinfo</div></div><div><div>  (_fun (cam ctx) :: (cam : _Camera-pointer) (v : (_ptr o _CameraStorageInformation-pointer)) (n : (_ptr o _int)) (ctx : _GPContext-ptr)</div></div><div><div>     -> _int</div></div><div><div>     -> n)) ; let's only check size for now</div></div></blockquote><div><br></div><div>Upon execution:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div>(gp_camera_get_storageinfo cam #f)</div></div></blockquote><div><br></div><div>It gives SIGSEGV MAPPER si_code 1</div><div><br></div><div>How one should go about such binding? Should the parameter involve some array helpers (here I've only tried to mimic pointer to a pointer, hoping that later I could wrap it in some array)?</div><div><br></div><div>Or maybe the struct has wrong size (there are enums...)?</div></div>