1 /* init.c - Various initializations
2 * Copyright (C) 2007 Free Software Foundation, Inc.
4 * This file is part of GnuPG.
6 * GnuPG is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * GnuPG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
22 #ifdef WITHOUT_GNU_PTH /* Give the Makefile a chance to build without Pth. */
27 #ifdef HAVE_W32_SYSTEM
38 /* This function is to be used early at program startup to make sure
39 that some subsystems are initialized. This is in particular
40 important for W32 to initialize the sockets so that our socket
41 emulation code used directly as well as in libassuan may be used.
42 It should best be called before any I/O is done so that setup
43 required for logging is ready. CAUTION: This might be called while
44 running suid(root). */
46 init_common_subsystems (void)
48 /* Try to auto set the character set. */
49 set_native_charset (NULL
);
51 #ifdef HAVE_W32_SYSTEM
52 /* For W32 we need to initialize the socket layer. This is because
53 we use recv and send in libassuan as well as at some other
54 places. If we are building with PTH we let pth_init do it. We
55 can't do much on error so we ignore them. An error would anyway
56 later pop up if one of the socket functions is used. */
63 WSAStartup (0x202, &wsadat
);
68 /* Initialize the Estream library. */