1996-11-08 06:47:40 -08:00
|
|
|
#include <string.h>
|
1999-11-18 05:14:27 -08:00
|
|
|
#include <caml/mlvalues.h>
|
|
|
|
#include <caml/callback.h>
|
1996-11-08 06:47:40 -08:00
|
|
|
|
|
|
|
/* Functions callable directly from C */
|
|
|
|
|
|
|
|
int fib(int n)
|
|
|
|
{
|
|
|
|
value * fib_closure = caml_named_value("fib");
|
|
|
|
return Int_val(callback(*fib_closure, Val_int(n)));
|
|
|
|
}
|
|
|
|
|
|
|
|
char * format_result(int n)
|
|
|
|
{
|
|
|
|
value * format_result_closure = caml_named_value("format_result");
|
|
|
|
return strdup(String_val(callback(*format_result_closure, Val_int(n))));
|
|
|
|
}
|