diff options
author | Mark Shinwell <mshinwell@gmail.com> | 2017-02-21 11:49:12 +0100 |
---|---|---|
committer | Mark Shinwell <mshinwell@gmail.com> | 2017-02-21 11:49:12 +0100 |
commit | 766d970e7890d41b63ebf164b38fa5365872ee34 (patch) | |
tree | 24d6f9ff6a1968684c400293582c659959a46a20 /asmrun | |
parent | b35b7229ee3695fee3e0b9dc5ca6aa119e420a9e (diff) | |
download | ocaml-766d970e7890d41b63ebf164b38fa5365872ee34.tar.gz |
Add caml_startup_exn
Diffstat (limited to 'asmrun')
-rw-r--r-- | asmrun/startup.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/asmrun/startup.c b/asmrun/startup.c index 8f469aedef..70bbc4369d 100644 --- a/asmrun/startup.c +++ b/asmrun/startup.c @@ -100,10 +100,9 @@ extern void caml_install_invalid_parameter_handler(); #endif -void caml_main(char **argv) +value caml_startup_exn(char **argv) { char * exe_name, * proc_self_exe; - value res; char tos; #ifdef WITH_SPACETIME @@ -140,14 +139,21 @@ void caml_main(char **argv) caml_sys_init(exe_name, argv); if (sigsetjmp(caml_termination_jmpbuf.buf, 0)) { if (caml_termination_hook != NULL) caml_termination_hook(NULL); - return; + return Val_unit; } - res = caml_start_program(); - if (Is_exception_result(res)) - caml_fatal_uncaught_exception(Extract_exception(res)); + return caml_start_program(); } void caml_startup(char **argv) { - caml_main(argv); + value res = caml_startup_exn(argv); + + if (Is_exception_result(res)) { + caml_fatal_uncaught_exception(Extract_exception(res)); + } +} + +void caml_main(char **argv) +{ + caml_startup(argv); } |