ea0d8a54aa3f83fc19f5c33489039285b5b0f659
[bpt/guile.git] / libguile / guile.c
1 /* Copyright (C) 1996,1997,2000,2001 Free Software Foundation, Inc.
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17
18 /* This is the 'main' function for the `guile' executable. It is not
19 included in libguile.a.
20
21 Eventually, we hope this file will be automatically generated,
22 based on the list of installed, statically linked libraries on the
23 system. For now, please don't put interesting code in here. */
24
25 #if HAVE_CONFIG_H
26 # include <config.h>
27 #endif
28
29 #ifdef __MINGW32__
30 # define SCM_IMPORT 1
31 #endif
32 #include <libguile.h>
33
34 #ifdef HAVE_CONFIG_H
35 #include <libguile/scmconfig.h>
36 #endif
37 #ifdef DYNAMIC_LINKING
38 #include <guile-ltdl.h>
39 #endif
40
41 #ifdef HAVE_WINSOCK2_H
42 #include <winsock2.h>
43 #endif
44
45 /* Debugger interface (don't change the order of the following lines) */
46 #define GDB_TYPE SCM
47 #include <libguile/gdb_interface.h>
48 GDB_INTERFACE;
49
50 static void
51 inner_main (void *closure SCM_UNUSED, int argc, char **argv)
52 {
53 #ifdef __MINGW32__
54 /* This is necessary to startup the Winsock API under Win32. */
55 WSADATA WSAData;
56 WSAStartup (0x0202, &WSAData);
57 GDB_INTERFACE_INIT;
58 #endif /* __MINGW32__ */
59
60 /* module initializations would go here */
61 scm_shell (argc, argv);
62
63 #ifdef __MINGW32__
64 WSACleanup ();
65 #endif /* __MINGW32__ */
66 }
67
68 int
69 main (int argc, char **argv)
70 {
71 #if defined (DYNAMIC_LINKING) && !defined (__MINGW32__)
72 /* libtool automagically inserts this variable into your executable... */
73 extern const scm_lt_dlsymlist lt_preloaded_symbols[];
74 scm_lt_dlpreload_default (lt_preloaded_symbols);
75 #endif
76 scm_boot_guile (argc, argv, inner_main, 0);
77 return 0; /* never reached */
78 }
79
80 /*
81 Local Variables:
82 c-file-style: "gnu"
83 End:
84 */