xapian-core  2.0.0
safewindows.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2005,2007,2013,2020 Olly Betts
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This program 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.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see
18  * <https://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef XAPIAN_INCLUDED_SAFEWINDOWS_H
22 #define XAPIAN_INCLUDED_SAFEWINDOWS_H
23 
24 #if !defined __CYGWIN__ && !defined __WIN32__
25 # error Including safewindows.h, but neither __CYGWIN__ nor __WIN32__ defined!
26 #endif
27 
28 // Prevent windows.h from defining min and max macros.
29 #ifndef NOMINMAX
30 # define NOMINMAX
31 #endif
32 
33 // Prevent windows.h from including lots of obscure win32 api headers
34 // which we don't care about and will just slow down compilation and
35 // increase the risk of symbol collisions.
36 #define WIN32_LEAN_AND_MEAN
37 #define NOGDI
38 #include <windows.h>
39 
40 // The mingw headers don't reach <winerror.h> from <windows.h> (verified
41 // with w32api 5.4.1). MSVC does, so we treat this as a flaw to workaround and
42 // include <winerror.h> if we detect it hasn't been implicitly included.
43 #ifndef ERROR_PIPE_CONNECTED
44 # include <winerror.h>
45 #endif
46 
47 #endif // XAPIAN_INCLUDED_SAFEWINDOWS_H