Simplify glib/glib/tests setup
[glib.git] / glib / gwin32.h
blobae87a45d4ed334816e9f029b7974059dd9a23abc
1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GLib Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GLib at ftp://ftp.gtk.org/pub/gtk/.
27 #ifndef __G_WIN32_H__
28 #define __G_WIN32_H__
30 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
31 #error "Only <glib.h> can be included directly."
32 #endif
34 #include <glib/gtypes.h>
36 #ifdef G_PLATFORM_WIN32
38 G_BEGIN_DECLS
40 #ifndef MAXPATHLEN
41 #define MAXPATHLEN 1024
42 #endif
44 #ifdef G_OS_WIN32
47 * To get prototypes for the following POSIXish functions, you have to
48 * include the indicated non-POSIX headers. The functions are defined
49 * in OLDNAMES.LIB (MSVC) or -lmoldname-msvc (mingw32). But note that
50 * for POSIX functions that take or return file names in the system
51 * codepage, in many cases you would want to use the GLib wrappers in
52 * gstdio.h and UTF-8 instead.
54 * getcwd: <direct.h> (MSVC), <io.h> (mingw32)
55 * getpid: <process.h>
56 * access: <io.h>
57 * unlink: <stdio.h> or <io.h>
58 * open, read, write, lseek, close: <io.h>
59 * rmdir: <io.h>
60 * pipe: <io.h> (actually, _pipe())
63 /* For some POSIX functions that are not provided by the MS runtime,
64 * we provide emulation functions in glib, which are prefixed with
65 * g_win32_. Or that was the idea at some time, but there is just one
66 * of those:
68 GLIB_AVAILABLE_IN_ALL
69 gint g_win32_ftruncate (gint f,
70 guint size);
71 #endif /* G_OS_WIN32 */
73 /* The MS setlocale uses locale names of the form "English_United
74 * States.1252" etc. We want the Unixish standard form "en", "zh_TW"
75 * etc. This function gets the current thread locale from Windows and
76 * returns it as a string of the above form for use in forming file
77 * names etc. The returned string should be deallocated with g_free().
79 GLIB_AVAILABLE_IN_ALL
80 gchar* g_win32_getlocale (void);
82 /* Translate a Win32 error code (as returned by GetLastError()) into
83 * the corresponding message. The returned string should be deallocated
84 * with g_free().
86 GLIB_AVAILABLE_IN_ALL
87 gchar* g_win32_error_message (gint error);
89 #ifndef _WIN64
90 GLIB_DEPRECATED
91 gchar* g_win32_get_package_installation_directory (const gchar *package,
92 const gchar *dll_name);
94 GLIB_DEPRECATED
95 gchar* g_win32_get_package_installation_subdirectory (const gchar *package,
96 const gchar *dll_name,
97 const gchar *subdir);
98 #endif
100 GLIB_AVAILABLE_IN_ALL
101 gchar* g_win32_get_package_installation_directory_of_module (gpointer hmodule);
103 GLIB_AVAILABLE_IN_ALL
104 guint g_win32_get_windows_version (void);
106 GLIB_AVAILABLE_IN_ALL
107 gchar* g_win32_locale_filename_from_utf8 (const gchar *utf8filename);
109 /* As of GLib 2.14 we only support NT-based Windows */
110 #define G_WIN32_IS_NT_BASED() TRUE
111 #define G_WIN32_HAVE_WIDECHAR_API() TRUE
113 G_END_DECLS
115 #endif /* G_PLATFORM_WIN32 */
117 #ifdef G_OS_WIN32
118 #ifdef _WIN64
119 #define g_win32_get_package_installation_directory g_win32_get_package_installation_directory_utf8
120 #define g_win32_get_package_installation_subdirectory g_win32_get_package_installation_subdirectory_utf8
121 #endif
123 GLIB_AVAILABLE_IN_ALL
124 gchar *g_win32_get_package_installation_directory_utf8 (const gchar *package,
125 const gchar *dll_name);
126 GLIB_AVAILABLE_IN_ALL
127 gchar *g_win32_get_package_installation_subdirectory_utf8 (const gchar *package,
128 const gchar *dll_name,
129 const gchar *subdir);
131 #endif /* G_OS_WIN32 */
133 #endif /* __G_WIN32_H__ */