Skip to content

Initializing MPQ.zarith in C structure? #3

Description

@akshajgaur

I am created inverted bindings. I have a structure in C where one of the elements is a rational number. I defined it in a struct in OCaml as MPQ.zarith, and in C, it is

mpq_ptr x

I was wondering how I could intitialize this field in c, and pass a value to OCaml. I haven't found much documentation. I tried to expose it as a void pointer, but it couldn't receive an input from c. Is defining a struct that has an rational number as simple as this? Or is there more to it.

  let x : [`x] structure typ = structure "x"
  let y = field x "z" (MPQ.zarith)
  let () = seal x

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions