summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib-dynlink-pr9209/dyn.ml
blob: 051e7afc39d7ab1f6c96f887e5dc363145406674 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
(* TEST

include dynlink
readonly_files = "lib.ml lib2.ml test.c"
ld_library_path += "${test_build_directory}"

* shared-libraries
** setup-ocamlc.byte-build-env
*** ocamlc.byte
compile_only = "true"
all_modules = "lib.ml lib2.ml test.c dyn.ml"
**** ocamlmklib
program = "lib"
modules = "lib.cmo test.${objext}"
compile_only = "false"
***** ocamlc.byte
program = "lib2.cma"
libraries = ""
all_modules = "lib2.cmo"
compile_only = "false"
flags = "-a"
****** ocamlc.byte
libraries += "dynlink"
program = "${test_build_directory}/main.exe"
all_modules = "dyn.cmo"
flags = ""
******* run
output = "main.output"
******** check-program-output

** native-dynlink
*** setup-ocamlopt.byte-build-env
**** ocamlopt.byte
compile_only = "true"
all_modules = "lib.ml lib2.ml test.c dyn.ml"
***** ocamlmklib
program = "test"
modules = "test.${objext}"
compile_only = "false"
****** ocamlopt.byte
program = "lib.cmxs"
libraries = ""
flags = "-shared -cclib -L. -cclib -ltest"
all_modules = "lib.cmx"
compile_only = "false"
******* ocamlopt.byte
program = "lib2.cmxs"
all_modules = "lib2.cmx"
compile_only = "false"
flags = "-shared"
******** ocamlopt.byte
libraries += "dynlink"
program = "${test_build_directory}/main.exe"
all_modules = "dyn.cmx"
flags = ""
********* run
output = "main.output"
********** check-program-output
*)
let () =
  Dynlink.allow_unsafe_modules true;
  Dynlink.adapt_filename "lib.cma" |> Dynlink.loadfile;
  Dynlink.adapt_filename "lib2.cma" |> Dynlink.loadfile