Simple stubs test
C stub library and executable that will run it
This commit is contained in:
parent
7d8ca23b62
commit
dfe0001b5a
|
@ -155,3 +155,10 @@
|
|||
(action
|
||||
(chdir test-cases/utop
|
||||
(setenv JBUILDER ${bin:jbuilder} (run ${exe:cram.exe} run.t))))))
|
||||
|
||||
(alias
|
||||
((name runtest)
|
||||
(deps ((files_recursively_in test-cases/c-stubs)))
|
||||
(action
|
||||
(chdir test-cases/c-stubs
|
||||
(setenv JBUILDER ${bin:jbuilder} (run ${exe:cram.exe} run.t))))))
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
(jbuild_version 1)
|
|
@ -0,0 +1,5 @@
|
|||
(jbuild_version 1)
|
||||
|
||||
(library
|
||||
((name q)
|
||||
(c_names (q_stub))))
|
|
@ -0,0 +1 @@
|
|||
#define ANSWER 42
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
external q : unit -> int = "ocaml_question"
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
val q : unit -> int
|
|
@ -0,0 +1,9 @@
|
|||
#include "q.h"
|
||||
#include <caml/mlvalues.h>
|
||||
#include <caml/memory.h>
|
||||
|
||||
CAMLprim value ocaml_question (value unit)
|
||||
{
|
||||
CAMLparam1 (unit);
|
||||
CAMLreturn (Val_int(ANSWER));
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
(jbuild_version 1)
|
||||
|
||||
(executable
|
||||
((name run)
|
||||
(libraries (q))))
|
|
@ -0,0 +1 @@
|
|||
print_int (Q.q ());;
|
|
@ -0,0 +1,14 @@
|
|||
$ $JBUILDER exec -j1 ./qnativerun/run.exe --root .
|
||||
ocamldep qnativerun/run.depends.ocamldep-output
|
||||
ocamlc q/q_stub.o
|
||||
ocamldep q/q.depends.ocamldep-output
|
||||
ocamldep q/q.dependsi.ocamldep-output
|
||||
ocamlmklib q/dllq_stubs.so,q/libq_stubs.a
|
||||
ocamlc q/q.{cmi,cmti}
|
||||
ocamlc qnativerun/run.{cmi,cmo,cmt}
|
||||
ocamlopt q/q.{cmx,o}
|
||||
ocamlopt qnativerun/run.{cmx,o}
|
||||
ocamlopt q/q.{a,cmxa}
|
||||
ocamlopt qnativerun/run.exe
|
||||
42
|
||||
# $ $JBUILDER exec -j1 ./qbyterun/run.bc --root .
|
Loading…
Reference in New Issue