summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-02-13 11:41:40 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-02-13 11:41:40 (GMT)
commit7467ce3eeadaedf89961884d5052a2d94a8b114e (patch)
treeba41511b6811c4dd41aa3a76d568b73cb8c9b2f3
parent2e4679db8ef02401a8e368c70a3272292420fecc (diff)
downloadcpython-7467ce3eeadaedf89961884d5052a2d94a8b114e.zip
cpython-7467ce3eeadaedf89961884d5052a2d94a8b114e.tar.gz
cpython-7467ce3eeadaedf89961884d5052a2d94a8b114e.tar.bz2
Startup code for applications using the python shared
library. Modified because the startup code has to work together with the runtime support in the shared library.
-rw-r--r--Mac/mwerks/macuseshlstart.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/Mac/mwerks/macuseshlstart.c b/Mac/mwerks/macuseshlstart.c
new file mode 100644
index 0000000..d26a89f
--- /dev/null
+++ b/Mac/mwerks/macuseshlstart.c
@@ -0,0 +1,29 @@
+/*
+** mac __start for python-with-shared-library.
+**
+** Partially stolen from MW Startup.c, which is
+** Copyright © 1993 metrowerks inc. All Rights Reserved.
+*/
+
+#include <setjmp.h>
+
+extern jmp_buf __program_exit; /* exit() does a longjmp() to here */
+extern void (*__atexit_hook)(void); /* atexit() sets this up if it is ever called */
+extern void (*___atexit_hook)(void); /* _atexit() sets this up if it is ever called */
+extern int __aborting; /* abort() sets this and longjmps to __program_exit */
+
+void __start(void)
+{
+ char *argv = 0;
+
+ if (setjmp(__program_exit) == 0) { // set up jmp_buf for exit()
+ main(0, &argv); // call main(argc, argv)
+ if (__atexit_hook)
+ __atexit_hook(); // call atexit() procs
+ }
+ if (!__aborting) {
+ if (___atexit_hook)
+ ___atexit_hook(); // call _atexit() procs
+ }
+// ExitToShell();
+}