blob: d26a89fd3a15cbf6847bb20affaa7fbfbc24026f [file] [log] [blame]
Jack Jansen7467ce31995-02-13 11:41:40 +00001/*
2** mac __start for python-with-shared-library.
3**
4** Partially stolen from MW Startup.c, which is
5** Copyright © 1993 metrowerks inc. All Rights Reserved.
6*/
7
8#include <setjmp.h>
9
10extern jmp_buf __program_exit; /* exit() does a longjmp() to here */
11extern void (*__atexit_hook)(void); /* atexit() sets this up if it is ever called */
12extern void (*___atexit_hook)(void); /* _atexit() sets this up if it is ever called */
13extern int __aborting; /* abort() sets this and longjmps to __program_exit */
14
15void __start(void)
16{
17 char *argv = 0;
18
19 if (setjmp(__program_exit) == 0) { // set up jmp_buf for exit()
20 main(0, &argv); // call main(argc, argv)
21 if (__atexit_hook)
22 __atexit_hook(); // call atexit() procs
23 }
24 if (!__aborting) {
25 if (___atexit_hook)
26 ___atexit_hook(); // call _atexit() procs
27 }
28// ExitToShell();
29}