shithub: MicroHs

Download patch

ref: 8a409d5543426756b38b50a32c96465b56ca2e37
parent: 7981d7389e1e91fee557a85f53ca3ae088eddf78
author: Rewbert <krookr@chalmers.se>
date: Mon Dec 18 11:36:09 EST 2023

add platform specific setup and teardown to main

--- a/src/runtime/eval.c
+++ b/src/runtime/eval.c
@@ -2587,6 +2587,12 @@
   setvbuf(stderr, NULL, _IONBF, BUFSIZ);
 #endif
 
+#ifdef INITIALIZATION
+  main_setup(); // void main_setup(void); will perform extra initialization
+                // that is unique to a specific platform, e.g. initialization
+                // a HAL
+#endif
+
   argc--, argv++;
   glob_argv = argv;
   for (av = argv, inrts = 0; argc--; argv++) {
@@ -2707,6 +2713,9 @@
 #endif
   }
 #endif  /* WANT_STDIO */
+#ifdef TEARDOWN
+  main_teardown(); // do some platform specific teardown
+#endif
   EXIT(0);
 }
 
--