Skip to content

Conversation

@omnisci3nce
Copy link
Contributor

@omnisci3nce omnisci3nce commented Mar 2, 2024

Addresses #9

Overview

Threads the basic Float and Double primitives from libclang through the IR and then c/caml generation.

Features

  • Adds a float into the doggo example
  • Get the C value (it automatically is casted from double to float since OCaml doesnt have 32bit floats AFAIK) with Double_val
  • If returning a struct back to OCaml we need it to be boxed and so the caml_copy_double function is used (just referenced the docs for this :) )

Future Improvements

I decided to just leave the fallback to val_int and int_val for now because if we want to do more intelligent matching there we probably need a way of either bubbling up errors or raising an exception and I don't want to touch that right now without having a proper discussion with you & others.


I'm going to test out type aliases next (I usually typedef float and double to f32/f64 respectively for example).

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

Successfully merging this pull request may close these issues.

1 participant