summaryrefslogtreecommitdiffstats
path: root/testsuite/tests/lib-dynlink-csharp/main.ml
blob: 079e3deb3e0dca705425ceafc2e16ce809bb012a (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
(***********************************************************************)
(*                                                                     *)
(*                                OCaml                                *)
(*                                                                     *)
(*                        Alain Frisch, LexiFi                         *)
(*                                                                     *)
(*  Copyright 2007 Institut National de Recherche en Informatique et   *)
(*  en Automatique.  All rights reserved.  This file is distributed    *)
(*  under the terms of the Q Public License version 1.0.               *)
(*                                                                     *)
(***********************************************************************)

let load s =
  Printf.printf "Loading %s\n%!" s;
  try
    Dynlink.loadfile s
  with Dynlink.Error e ->
    print_endline (Dynlink.error_message e)

let () =
  print_endline "Main is running.";
  Dynlink.init ();
  Dynlink.allow_unsafe_modules true;
  let s1,s2 =
    if Dynlink.is_native then
      "../../../otherlibs/bigarray/bigarray.cmxs",
      "plugin.cmxs"
    else
      "../../../otherlibs/bigarray/bigarray.cma",
      "plugin.cmo"
  in
  load s1;
  load s2;
  print_endline "OK."