This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
|
|
@ -0,0 +1,71 @@
|
|||
(alias
|
||||
(name all)
|
||||
(deps test.bc
|
||||
test.exe
|
||||
; test.bc.c
|
||||
test.bc%{ext_obj}
|
||||
test.exe%{ext_obj}
|
||||
test.bc%{ext_dll}
|
||||
test%{ext_dll}
|
||||
static.bc
|
||||
static.exe))
|
||||
|
||||
(executable
|
||||
(name test)
|
||||
(modes (byte exe )
|
||||
(native exe )
|
||||
; (byte c )
|
||||
(byte object )
|
||||
(native object )
|
||||
(byte shared_object)
|
||||
(native shared_object)))
|
||||
|
||||
(rule
|
||||
(targets static.exe)
|
||||
(deps test.exe%{ext_obj} static.c)
|
||||
(action (run %{cc} -o %{targets} -I %{ocaml_where} -I . %{deps}
|
||||
%{ocaml-config:native_c_libraries})))
|
||||
|
||||
(rule
|
||||
(targets static.bc)
|
||||
(deps test.bc%{ext_obj} static.c)
|
||||
(action (run %{cc} -o %{targets} -I %{ocaml_where} -I . %{deps}
|
||||
%{ocaml-config:bytecomp_c_libraries})))
|
||||
|
||||
;(rule
|
||||
; (targets static.bc.c.exe)
|
||||
; (deps test.bc.c static.c)
|
||||
; (action (run %{cc} -o %{targets} -I %{ocaml_where} -I . %{deps}
|
||||
; %{ocaml-config:bytecomp_c_libraries} -L %{ocaml_where} -lcamlrun)))
|
||||
|
||||
(rule
|
||||
(targets dynamic.exe)
|
||||
(deps dynamic.c)
|
||||
(action (run %{cc} -o %{targets} %{deps} %{ocaml-config:native_c_libraries})))
|
||||
|
||||
(alias
|
||||
(name runtest)
|
||||
(action
|
||||
(run ./static.exe)))
|
||||
|
||||
(alias
|
||||
(name runtest)
|
||||
(action
|
||||
(run ./static.bc)))
|
||||
|
||||
;; This fails in travis. Can't seem to find libcamlrun (see pull request #1229
|
||||
;; for discussion)
|
||||
;(alias
|
||||
; (name runtest)
|
||||
; (action
|
||||
; (run ./static.bc.c.exe)))
|
||||
|
||||
(alias
|
||||
(name runtest)
|
||||
(deps test.bc%{ext_dll})
|
||||
(action (run ./dynamic.exe ./%{deps})))
|
||||
|
||||
(alias
|
||||
(name runtest)
|
||||
(deps test%{ext_dll})
|
||||
(action (run ./dynamic.exe ./%{deps})))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 1.0)
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#include <stdio.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
void *handle;
|
||||
void (*caml_startup)(char **argv);
|
||||
handle = dlopen(argv[1], RTLD_NOW | RTLD_GLOBAL);
|
||||
if (handle == NULL) {
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
return 1;
|
||||
}
|
||||
caml_startup = dlsym(handle, "caml_startup");
|
||||
if (handle == NULL) {
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
return 1;
|
||||
}
|
||||
caml_startup(argv);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
$ dune build @all
|
||||
$ dune build @runtest 2>&1 | dune_cmd sanitize
|
||||
OK: ./static.exe
|
||||
OK: ./static.bc
|
||||
OK: ./dynamic.exe ./test.bc$ext_dll
|
||||
OK: ./dynamic.exe ./test$ext_dll
|
||||
# static alias runtest
|
||||
# OK: ./static.bc.c.exe
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#include <caml/mlvalues.h>
|
||||
#include <caml/alloc.h>
|
||||
#include <caml/callback.h>
|
||||
#include <caml/memory.h>
|
||||
|
||||
int main(int argc, char ** argv){
|
||||
|
||||
caml_startup(argv);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
let () =
|
||||
Printf.printf "OK: %s\n%!" (String.concat " " (Array.to_list Sys.argv))
|
||||
Loading…
Add table
Add a link
Reference in a new issue