Sys.Signals module for a Variant type of signals (and a set_signal function that...
[ocaml.git] / byterun / main.c
blobe6afb1b3265b6d344bbaf14ee8963ce9194cd0e0
1 /***********************************************************************/
2 /* */
3 /* Objective Caml */
4 /* */
5 /* Xavier Leroy and Damien Doligez, INRIA Rocquencourt */
6 /* */
7 /* Copyright 1996 Institut National de Recherche en Informatique et */
8 /* en Automatique. All rights reserved. This file is distributed */
9 /* under the terms of the GNU Library General Public License, with */
10 /* the special exception on linking described in file ../LICENSE. */
11 /* */
12 /***********************************************************************/
14 /* $Id$ */
16 /* Main entry point (can be overridden by a user-provided main()
17 function that calls caml_main() later). */
19 #include "misc.h"
20 #include "mlvalues.h"
21 #include "sys.h"
23 CAMLextern void caml_main (char **);
25 #ifdef _WIN32
26 CAMLextern void caml_expand_command_line (int *, char ***);
27 #endif
29 int main(int argc, char **argv)
31 #ifdef DEBUG
33 char *ocp;
34 char *cp;
35 int i;
37 caml_gc_message (-1, "### OCaml runtime: debug mode ###\n", 0);
38 #if 0
39 caml_gc_message (-1, "### command line:", 0);
40 for (i = 0; i < argc; i++){
41 caml_gc_message (-1, " %s", argv[i]);
43 caml_gc_message (-1, "\n", 0);
44 ocp = getenv ("OCAMLRUNPARAM");
45 caml_gc_message (-1, "### OCAMLRUNPARAM=%s\n", ocp == NULL ? "" : ocp);
46 cp = getenv ("CAMLRUNPARAM");
47 caml_gc_message (-1, "### CAMLRUNPARAM=%s\n", cp == NULL ? "" : cp);
48 caml_gc_message (-1, "### working dir: %s\n", getcwd (NULL, 0));
49 #endif
51 #endif
52 #ifdef _WIN32
53 /* Expand wildcards and diversions in command line */
54 caml_expand_command_line(&argc, &argv);
55 #endif
56 caml_main(argv);
57 caml_sys_exit(Val_int(0));
58 return 0; /* not reached */