Family Day update

This commit is contained in:
Ingy döt Net 2020-02-17 23:21:07 -08:00
parent aac6731f2c
commit 9ad63ea473
2442 changed files with 39761 additions and 8255 deletions

View file

@ -1,3 +1,3 @@
void myfunc_a();
float myfunc_b(int, float);
char *myfunc_c(int *);
char *myfunc_c(int *, int);

View file

@ -9,7 +9,7 @@ caml_myfunc_a(value unit) {
}
CAMLprim value
caml_myfunc_b(value a; value b) {
caml_myfunc_b(value a, value b) {
float c = myfunc_b(Int_val(a), Double_val(b));
return caml_copy_double(c);
}
@ -24,7 +24,7 @@ caml_myfunc_c(value ml_array) {
for (i=0; i < len; i++) {
arr[i] = Int_val(Field(ml_array, i));
}
s = myfunc_c(arr);
s = myfunc_c(arr, len);
free(arr);
return caml_copy_string(s);
}

View file

@ -0,0 +1,11 @@
open Ctypes
open Foreign
let myfunc_a = foreign "myfunc_a" (void @-> returning void)
let myfunc_b = foreign "myfunc_b" (int @-> float @-> returning float)
let myfunc_c = foreign "myfunc_c" (ptr void @-> int @-> returning string)
let myfunc_c lst =
let arr = CArray.of_list int lst in
myfunc_c (to_voidp (CArray.start arr)) (CArray.length arr)
;;