int fact(int n) {
if (n <= 1) return 1;
else return n*fact(n-1);
}
int my_mod(int x, int y) {
return (x%y);
}
I fail with the latter:
# _fact (C_int 5);;
- : Example.c_obj = C_int 120
# _my_mod (C_int 6) (C_int 3);;
This function is applied to too many arguments, maybe you forgot a `;'
What's going on here? How do I accomplish this simple task?
BTW, the swig ocaml documentation is quite inadequate.
Best,
--
Eray
nebula:swig-example$ ./mytop
Objective Caml version 3.09.2
# open Swig;;
# open Example;;
# let x = _my_mod( C_list [C_int 10; C_int 4]);;
val x : Example.c_obj = C_int 2
# print_int (get_int x);;
2- : unit = ()
I couldn't get ocamlp4 to work and even if it did I'm not used to it so
I have to stick with this. Grrrrrrrr.
Now, the "real" module that I'm trying to wrap segfaults. Great.