Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write_compute_value_instructions` doesn't consider Nullable pointers #28

Open
ManasJayanth opened this issue Jan 24, 2019 · 1 comment

Comments

@ManasJayanth
Copy link
Contributor

Trying to generate bindings for Gstreamer (GstTagList), I get the following on compiling the generated bindings.

File "lib/Tag_list.ml", line 38, characters 34-43:
Error: This expression has type
         GLib.Date.t Ctypes.structure Ctypes_static.ptr option Ctypes.ptr =
           (GLib.Date.t Ctypes.structure Ctypes_static.ptr option, [ `C ])
           Ctypes_static.pointer
       but an expression was expected of type
         GLib.Date.t Ctypes.structure Ctypes_static.ptr Ctypes_static.ptr =
           (GLib.Date.t Ctypes.structure Ctypes_static.ptr, [ `C ])
           Ctypes_static.pointer
       Type GLib.Date.t Ctypes.structure Ctypes_static.ptr option
       is not compatible with type
         GLib.Date.t Ctypes.structure Ctypes_static.ptr =
           (GLib.Date.t Ctypes.structure, [ `C ]) Ctypes_static.pointer

Pointing to a line like this

  let value_ptr = allocate (ptr_opt Date.t_typ) None in                                                                                                                                                            
  let ret = get_date_raw self tag value_ptr in 

I think write_compute_value_instructions must check if the out args (inout args too I'm guessing) could be a Nullable.

I couldn't find the right patch to get this work, if I have any luck, I'll raise a PR.

@ManasJayanth
Copy link
Contributor Author

Related

  in
  let format_ptr = allocate Format.t_view (Format.t_view.of_value (Unsigned.UInt32.zero)) in
  let processed_ptr = allocate uint64_t Unsigned.UInt64.zero in

Format.t_view doesn't actually have of_value

Format.mli

open Ctypes                                                                                                                                                                                                        
                                                                                                                                                                                                                   
type t = Undefined | Default | Bytes | Time | Buffers | Percent                                                                                                                                                    
                                                                                                                                                                                                                   
val of_value:                                                                                                                                                                                                      
  Unsigned.uint32 -> t                                                                                                                                                                                             
                                                                                                                                                                                                                   
val to_value:                                                                                                                                                                                                      
  t -> Unsigned.uint32                                                                                                                                                                                             
                                                                                                                                                                                                                   
val t_view: t typ     

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant