i.e. gcc -mno-cygwin on cygwin (a.k.a. mingw32, using egcs-1.1.2).
* README.win32: Updated.
* build-dll makefile.cygwin tests/makefile.cygwin: New files.
* glib.h glib.def glibconfig.h.win32 makefile.msc: Slight updates.
* gmain.c: No need to include <fcntl.h> and <io.h> on Win32.
* gmain.c gutils.c testglib.c tests/string-test.c: Test for
NATIVE_WIN32, not _MSC_VER.
* gmutex.c: Must declare g_thread_functions_for_glib_use as
exported (using the GUTILS_C_VAR macro).
* gutils.c gmodule/libgplugin_[ab].c: LibMain not needed.
* gmodule/gmoduleconf.h.win32: Need underscore with gcc.
* gthread/gthread.c: With gcc on Win32, must use memcpy to assign
value of g_thread_functions_for_glib_use (?).
* makefile.msc tests/makefile.msc: Cosmetics.
+1999-04-24 Tor Lillqvist <tml@iki.fi>
+
+ Support added for building using a GNU toolchain on Win32,
+ i.e. gcc -mno-cygwin on cygwin (a.k.a. mingw32, using egcs-1.1.2).
+
+ * README.win32: Updated.
+ * build-dll makefile.cygwin tests/makefile.cygwin: New files.
+ * glib.h glib.def glibconfig.h.win32: Slight updates.
+ * gmain.c: No need to include <fcntl.h> and <io.h> on Win32.
+ * gmain.c gutils.c testglib.c tests/string-test.c: Test for
+ NATIVE_WIN32, not _MSC_VER.
+ * gmutex.c: Must declare g_thread_functions_for_glib_use as
+ exported (using the GUTILS_C_VAR macro).
+ * gutils.c gmodule/libgplugin_[ab].c: LibMain not needed.
+ * gmodule/gmoduleconf.h.win32: Need underscore with gcc.
+ * gthread/gthread.c: With gcc on Win32, must use memcpy to assign
+ value of g_thread_functions_for_glib_use (?).
+ * makefile.msc tests/makefile.msc: Cosmetics.
+
Fri Apr 23 14:29:25 BST 1999 Tony Gale <gale@gtk.org>
* glib.h: Fix typo in g_string_ncasecmp macro (by me).
+1999-04-24 Tor Lillqvist <tml@iki.fi>
+
+ Support added for building using a GNU toolchain on Win32,
+ i.e. gcc -mno-cygwin on cygwin (a.k.a. mingw32, using egcs-1.1.2).
+
+ * README.win32: Updated.
+ * build-dll makefile.cygwin tests/makefile.cygwin: New files.
+ * glib.h glib.def glibconfig.h.win32: Slight updates.
+ * gmain.c: No need to include <fcntl.h> and <io.h> on Win32.
+ * gmain.c gutils.c testglib.c tests/string-test.c: Test for
+ NATIVE_WIN32, not _MSC_VER.
+ * gmutex.c: Must declare g_thread_functions_for_glib_use as
+ exported (using the GUTILS_C_VAR macro).
+ * gutils.c gmodule/libgplugin_[ab].c: LibMain not needed.
+ * gmodule/gmoduleconf.h.win32: Need underscore with gcc.
+ * gthread/gthread.c: With gcc on Win32, must use memcpy to assign
+ value of g_thread_functions_for_glib_use (?).
+ * makefile.msc tests/makefile.msc: Cosmetics.
+
Fri Apr 23 14:29:25 BST 1999 Tony Gale <gale@gtk.org>
* glib.h: Fix typo in g_string_ncasecmp macro (by me).
+1999-04-24 Tor Lillqvist <tml@iki.fi>
+
+ Support added for building using a GNU toolchain on Win32,
+ i.e. gcc -mno-cygwin on cygwin (a.k.a. mingw32, using egcs-1.1.2).
+
+ * README.win32: Updated.
+ * build-dll makefile.cygwin tests/makefile.cygwin: New files.
+ * glib.h glib.def glibconfig.h.win32: Slight updates.
+ * gmain.c: No need to include <fcntl.h> and <io.h> on Win32.
+ * gmain.c gutils.c testglib.c tests/string-test.c: Test for
+ NATIVE_WIN32, not _MSC_VER.
+ * gmutex.c: Must declare g_thread_functions_for_glib_use as
+ exported (using the GUTILS_C_VAR macro).
+ * gutils.c gmodule/libgplugin_[ab].c: LibMain not needed.
+ * gmodule/gmoduleconf.h.win32: Need underscore with gcc.
+ * gthread/gthread.c: With gcc on Win32, must use memcpy to assign
+ value of g_thread_functions_for_glib_use (?).
+ * makefile.msc tests/makefile.msc: Cosmetics.
+
Fri Apr 23 14:29:25 BST 1999 Tony Gale <gale@gtk.org>
* glib.h: Fix typo in g_string_ncasecmp macro (by me).
+1999-04-24 Tor Lillqvist <tml@iki.fi>
+
+ Support added for building using a GNU toolchain on Win32,
+ i.e. gcc -mno-cygwin on cygwin (a.k.a. mingw32, using egcs-1.1.2).
+
+ * README.win32: Updated.
+ * build-dll makefile.cygwin tests/makefile.cygwin: New files.
+ * glib.h glib.def glibconfig.h.win32: Slight updates.
+ * gmain.c: No need to include <fcntl.h> and <io.h> on Win32.
+ * gmain.c gutils.c testglib.c tests/string-test.c: Test for
+ NATIVE_WIN32, not _MSC_VER.
+ * gmutex.c: Must declare g_thread_functions_for_glib_use as
+ exported (using the GUTILS_C_VAR macro).
+ * gutils.c gmodule/libgplugin_[ab].c: LibMain not needed.
+ * gmodule/gmoduleconf.h.win32: Need underscore with gcc.
+ * gthread/gthread.c: With gcc on Win32, must use memcpy to assign
+ value of g_thread_functions_for_glib_use (?).
+ * makefile.msc tests/makefile.msc: Cosmetics.
+
Fri Apr 23 14:29:25 BST 1999 Tony Gale <gale@gtk.org>
* glib.h: Fix typo in g_string_ncasecmp macro (by me).
+1999-04-24 Tor Lillqvist <tml@iki.fi>
+
+ Support added for building using a GNU toolchain on Win32,
+ i.e. gcc -mno-cygwin on cygwin (a.k.a. mingw32, using egcs-1.1.2).
+
+ * README.win32: Updated.
+ * build-dll makefile.cygwin tests/makefile.cygwin: New files.
+ * glib.h glib.def glibconfig.h.win32: Slight updates.
+ * gmain.c: No need to include <fcntl.h> and <io.h> on Win32.
+ * gmain.c gutils.c testglib.c tests/string-test.c: Test for
+ NATIVE_WIN32, not _MSC_VER.
+ * gmutex.c: Must declare g_thread_functions_for_glib_use as
+ exported (using the GUTILS_C_VAR macro).
+ * gutils.c gmodule/libgplugin_[ab].c: LibMain not needed.
+ * gmodule/gmoduleconf.h.win32: Need underscore with gcc.
+ * gthread/gthread.c: With gcc on Win32, must use memcpy to assign
+ value of g_thread_functions_for_glib_use (?).
+ * makefile.msc tests/makefile.msc: Cosmetics.
+
Fri Apr 23 14:29:25 BST 1999 Tony Gale <gale@gtk.org>
* glib.h: Fix typo in g_string_ncasecmp macro (by me).
+1999-04-24 Tor Lillqvist <tml@iki.fi>
+
+ Support added for building using a GNU toolchain on Win32,
+ i.e. gcc -mno-cygwin on cygwin (a.k.a. mingw32, using egcs-1.1.2).
+
+ * README.win32: Updated.
+ * build-dll makefile.cygwin tests/makefile.cygwin: New files.
+ * glib.h glib.def glibconfig.h.win32: Slight updates.
+ * gmain.c: No need to include <fcntl.h> and <io.h> on Win32.
+ * gmain.c gutils.c testglib.c tests/string-test.c: Test for
+ NATIVE_WIN32, not _MSC_VER.
+ * gmutex.c: Must declare g_thread_functions_for_glib_use as
+ exported (using the GUTILS_C_VAR macro).
+ * gutils.c gmodule/libgplugin_[ab].c: LibMain not needed.
+ * gmodule/gmoduleconf.h.win32: Need underscore with gcc.
+ * gthread/gthread.c: With gcc on Win32, must use memcpy to assign
+ value of g_thread_functions_for_glib_use (?).
+ * makefile.msc tests/makefile.msc: Cosmetics.
+
Fri Apr 23 14:29:25 BST 1999 Tony Gale <gale@gtk.org>
* glib.h: Fix typo in g_string_ncasecmp macro (by me).
+1999-04-24 Tor Lillqvist <tml@iki.fi>
+
+ Support added for building using a GNU toolchain on Win32,
+ i.e. gcc -mno-cygwin on cygwin (a.k.a. mingw32, using egcs-1.1.2).
+
+ * README.win32: Updated.
+ * build-dll makefile.cygwin tests/makefile.cygwin: New files.
+ * glib.h glib.def glibconfig.h.win32: Slight updates.
+ * gmain.c: No need to include <fcntl.h> and <io.h> on Win32.
+ * gmain.c gutils.c testglib.c tests/string-test.c: Test for
+ NATIVE_WIN32, not _MSC_VER.
+ * gmutex.c: Must declare g_thread_functions_for_glib_use as
+ exported (using the GUTILS_C_VAR macro).
+ * gutils.c gmodule/libgplugin_[ab].c: LibMain not needed.
+ * gmodule/gmoduleconf.h.win32: Need underscore with gcc.
+ * gthread/gthread.c: With gcc on Win32, must use memcpy to assign
+ value of g_thread_functions_for_glib_use (?).
+ * makefile.msc tests/makefile.msc: Cosmetics.
+
Fri Apr 23 14:29:25 BST 1999 Tony Gale <gale@gtk.org>
* glib.h: Fix typo in g_string_ncasecmp macro (by me).
+1999-04-24 Tor Lillqvist <tml@iki.fi>
+
+ Support added for building using a GNU toolchain on Win32,
+ i.e. gcc -mno-cygwin on cygwin (a.k.a. mingw32, using egcs-1.1.2).
+
+ * README.win32: Updated.
+ * build-dll makefile.cygwin tests/makefile.cygwin: New files.
+ * glib.h glib.def glibconfig.h.win32: Slight updates.
+ * gmain.c: No need to include <fcntl.h> and <io.h> on Win32.
+ * gmain.c gutils.c testglib.c tests/string-test.c: Test for
+ NATIVE_WIN32, not _MSC_VER.
+ * gmutex.c: Must declare g_thread_functions_for_glib_use as
+ exported (using the GUTILS_C_VAR macro).
+ * gutils.c gmodule/libgplugin_[ab].c: LibMain not needed.
+ * gmodule/gmoduleconf.h.win32: Need underscore with gcc.
+ * gthread/gthread.c: With gcc on Win32, must use memcpy to assign
+ value of g_thread_functions_for_glib_use (?).
+ * makefile.msc tests/makefile.msc: Cosmetics.
+
Fri Apr 23 14:29:25 BST 1999 Tony Gale <gale@gtk.org>
* glib.h: Fix typo in g_string_ncasecmp macro (by me).
by the Microsoft runtime C library. Additionally, a pthreads emulation
library is used.
-As for now, to build GLib on Win32, you need the Microsoft compiler
-and tools. Both the compiler from MSVC 5.0 and from MSVC 6.0 have been
-used successfully.
+To build GLib on Win32, you can use either the Microsoft compiler and
+tools, or egcs-1.1.2 running under cygwin-b20.1. Both the compiler
+from MSVC 5.0 and from MSVC 6.0 have been used successfully. If you
+build with egcs, note that the produced executables and DLLs do *not*
+require the cygwin dll ("mingw32"). That's the whole point of this
+porting effort, more or less.
+
+The egcs support was added quite recently, but seems to work in all
+respects. Debugging with gdk works.
Before building you must get the pthreads library for Windows from
http://sourceware.cygnus.com/pthreads-win32/. The pthreads-win32
-snapshot from 1999-03-16 is mostly OK. Edit the location of the
-pthreads library and include files in makefile.msc. Also edit the BIN
-definition in makefile.msc.
+snapshot from 1999-04-07 is the one that should be used. Edit the
+location of the pthreads library and include files in
+makefile.msc.
-Build with `nmake -f makefile.msc`. Install with `nmake -f
-makefile.msc install`.
+If using the Microsoft toolchain, build with `nmake -f
+makefile.msc`. Install with `nmake -f makefile.msc install`.
+If using egcs, build using `make -f makefile.cygwin`.
To test the GLib functions, go to the tests subdirectory and enter
`nmake -f makefile.msc check`.
-Support for building using the cygwin tools (without depending on the
-cygwin runtime, i.e. "mingw32"), and maybe LCC-Win32 might be added
-later. When using the cygwin tools *with* the cygwin runtime the
-normal Unix configuration method should work as if on Unix (knock on
-wood).
+If you would want to use the cygwin tools to generate executables that
+*do* usethe cygwin runtime the normal Unix configuration method should
+work as if on Unix (knock on wood).
With a little work, it might be possible to use the ./configure
-mechanism also with a "mingw32" configuration. I.e. building GLib for
-Win32 would use the cygwin tools (and runtime), but the produced
-libraries would not depend on the cygwin runtime being present.
+mechanism also with a "mingw32" configuration.
The following preprocessor macros are used for conditional compilation
related to Win32:
- NATIVE_WIN32 is defined when compiling for Win32, *and* without
any POSIX emulation, other that to the extent provided by the
- (Microsoft) C library, or the pthreads-win32 library. For instance,
- pathnames use the native Windows syntax.
+ bundled Microsoft C library and the pthreads-win32 library. For
+ instance, pathnames are in the native Windows syntax.
-- _MSC_VER is defined when using the Microsoft compiler.
+The Win32 port uses the combination with both of those on.
-Currently the Win32 port uses the combination with all three of those
-on, but eventually "gcc -mno-cygwin" will be supported also, and in
-that case _MSC_VER wouldn't be defined.
+Additionally, there are the compiler-specific macros:
+- _MSC_VER is defined when using the Microsoft compiler
+- __GNUC__ is defined when using GCC (i.e. egcs)
-Some of the usage of these macros is probably a bit mixed up, and will
-have to be straightened out when actually trying other combinations.
+Some of the usage of these macros was a bit mixed up, and had to be
+straightened out when adding the gcc support. In particular, I used to
+check for _MSC_VER in some places where I really wanted to check for
+the Microsoft C library, and those checks has now been changed to
+NATIVE_WIN32.
The pthreads for Win32 package that the thread support uses isn't
quite ready yet, and thus threads really should not be relied upon.
--- /dev/null
+#!/bin/sh
+
+# Temporary hack until building dlls with gcc -mno-cygwin is easier
+
+LD=ld
+DLLTOOL=dlltool
+AS=as
+
+library=$1; shift
+version=$1; shift;
+def=$1; shift
+ldargs="$*"
+
+defswitch=""
+[ -n "$def" -a "$def" != '-' ] && defswitch="--def $def"
+
+libname=$library
+[ $version != '-' ] && libname=$library-$version
+dllfile=$libname.dll
+
+for F in $ldargs; do
+ case $F in
+ *.o) objs="$objs $F";;
+ esac
+done
+
+$LD -s --base-file $library.base --dll -o $dllfile $ldargs -e _DllMain@12 -lmingw32
+$DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs
+$LD -s --base-file $library.base $library.exp --dll -o $dllfile $ldargs -e _DllMain@12 -lmingw32
+$DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs
+$LD $library.exp --dll -o $dllfile $ldargs -e _DllMain@12 -lmingw32
+$DLLTOOL --as=$AS --dllname $dllfile $defswitch --output-lib lib$libname.a $objs
+rm $library.base $library.exp
g_date_is_last_of_month
g_date_is_leap_year
g_date_julian
- g_date_julian
g_date_monday_week_of_year
g_date_monday_weeks_in_year
g_date_new
g_string_new
g_string_prepend
g_string_prepend_c
+ g_string_readline
+ g_string_readline_buffered
g_string_sized_new
g_string_sprintf
g_string_sprintfa
+ g_string_tokenise
+ g_string_tokenise_free
g_string_truncate
g_string_up
g_strjoinv
*/
#ifdef NATIVE_WIN32
# define MAXPATHLEN 1024
-# ifdef _MSC_VER
+
+#ifdef _MSC_VER
typedef int pid_t;
+#endif
/* These POSIXish functions are available in the Microsoft C library
* prefixed with underscore (which of course technically speaking is
# define getcwd _getcwd
# define getpid _getpid
# define access _access
+#ifdef __GNUC__
+# define stat _stat
+#endif
# define open _open
# define read _read
# define write _write
struct dirent* gwin_readdir (DIR *dir);
void gwin_rewinddir (DIR *dir);
gint gwin_closedir (DIR *dir);
-# endif /* _MSC_VER */
#endif /* NATIVE_WIN32 */
g_date_is_last_of_month
g_date_is_leap_year
g_date_julian
- g_date_julian
g_date_monday_week_of_year
g_date_monday_weeks_in_year
g_date_new
g_string_new
g_string_prepend
g_string_prepend_c
+ g_string_readline
+ g_string_readline_buffered
g_string_sized_new
g_string_sprintf
g_string_sprintfa
+ g_string_tokenise
+ g_string_tokenise_free
g_string_truncate
g_string_up
g_strjoinv
*/
#ifdef NATIVE_WIN32
# define MAXPATHLEN 1024
-# ifdef _MSC_VER
+
+#ifdef _MSC_VER
typedef int pid_t;
+#endif
/* These POSIXish functions are available in the Microsoft C library
* prefixed with underscore (which of course technically speaking is
# define getcwd _getcwd
# define getpid _getpid
# define access _access
+#ifdef __GNUC__
+# define stat _stat
+#endif
# define open _open
# define read _read
# define write _write
struct dirent* gwin_readdir (DIR *dir);
void gwin_rewinddir (DIR *dir);
gint gwin_closedir (DIR *dir);
-# endif /* _MSC_VER */
#endif /* NATIVE_WIN32 */
#include <windows.h>
#endif /* NATIVE_WIN32 */
-#ifdef _MSC_VER
-#include <fcntl.h>
-#include <io.h>
-#endif /* _MSC_VER */
-
/* Types */
typedef struct _GTimeoutData GTimeoutData;
void
g_get_current_time (GTimeVal *result)
{
-#ifndef _MSC_VER
+#ifndef NATIVE_WIN32
struct timeval r;
g_return_if_fail (result != NULL);
const guint glib_interface_age = GLIB_INTERFACE_AGE;
const guint glib_binary_age = GLIB_BINARY_AGE;
-#if defined (NATIVE_WIN32) && defined (__LCC__)
-int __stdcall
-LibMain (void *hinstDll,
- unsigned long dwReason,
- void *reserved)
-{
- return 1;
-}
-#endif /* NATIVE_WIN32 && __LCC__ */
-
void
g_atexit (GVoidFunc func)
{
#endif /* Old IO Channels */
#ifdef NATIVE_WIN32
-#ifdef _MSC_VER
int
gwin_ftruncate (gint fd,
return 0;
}
-#endif /* _MSC_VER */
-
#endif /* NATIVE_WIN32 */
/* glibconfig.h.win32 */
-/* Handcrafted for Microsoft C. */
+/* Handcrafted for Microsoft C and gcc -mno-cygwin ("mingw32"). */
#ifndef GLIBCONFIG_H
#define GLIBCONFIG_H
#define G_HAVE_GINT64 1
+/* These are compiler specific */
+#ifdef _MSC_VER
typedef __int64 gint64;
typedef unsigned __int64 guint64;
+#define G_GINT64_CONSTANT(val) (val##i64)
+#elif __GNUC__
+typedef long long gint64;
+typedef unsigned long long guint64;
+#define G_GINT64_CONSTANT(val) (val##LL)
+#endif
+
+/* These depend on the C library. Using this file means the we
+ * use the (bundled) Microsoft msvcrt.dll.
+ */
#define G_GINT64_FORMAT "I64i"
#define G_GUINT64_FORMAT "I64u"
-#define G_GINT64_CONSTANT(val) (val##i64)
#define GPOINTER_TO_INT(p) ((gint)(p))
#define GPOINTER_TO_UINT(p) ((guint)(p))
#define g_memmove(d,s,n) G_STMT_START { memmove ((d), (s), (n)); } G_STMT_END
#define G_HAVE_ALLOCA 1
+#ifdef _MSC_VER
#define alloca _alloca
+#endif
#define GLIB_MAJOR_VERSION 1
#define GLIB_MINOR_VERSION 3
* printf ("sizeof (pthread_mutex_t) = %d\n", sizeof (pthread_mutex_t));
* printf ("PTHREAD_MUTEX_INITIALIZER = ");
* for (i = 0; i < sizeof (pthread_mutex_t); i++)
- * printf ("%u, ", (unsigned) ((char *) &m)[i]);
+ * printf ("%u, ", (unsigned) ((unsigned char *) &m)[i]);
* printf ("\n");
* exit(0);
* }
struct _GMutex *runtime_mutex;
union {
/* The size of the pad array should be sizeof (pthread_mutext_t) */
- /* This value corresponds to the 1999-03-16 version of pthreads-win32 */
+ /* This value corresponds to the 1999-04-07 version of pthreads-win32 */
char pad[4];
double dummy_double;
void *dummy_pointer;
} aligned_pad_u;
};
/* This should be NULL followed by the bytes in PTHREAD_MUTEX_INITIALIZER */
-#define G_STATIC_MUTEX_INIT { NULL, { { 1, 0, 0, 0 } } }
+#define G_STATIC_MUTEX_INIT { NULL, { { 255, 255, 255, 255 } } }
#define g_static_mutex_get_mutex(mutex) \
(g_thread_use_default_impl ? ((GMutex*) &((mutex)->aligned_pad_u)) : \
g_static_mutex_get_mutex_impl (&((mutex)->runtime_mutex)))
/* Define if this is Win32, possibly using the Cygwin emulation layer. */
#define WIN32 1
-/* Define if this is Win32 without Cygwin. */
+/* Define if this is Win32 using the Microsoft C runtime. */
#define NATIVE_WIN32 1
#ifdef __cplusplus
#include <windows.h>
#endif /* NATIVE_WIN32 */
-#ifdef _MSC_VER
-#include <fcntl.h>
-#include <io.h>
-#endif /* _MSC_VER */
-
/* Types */
typedef struct _GTimeoutData GTimeoutData;
void
g_get_current_time (GTimeVal *result)
{
-#ifndef _MSC_VER
+#ifndef NATIVE_WIN32
struct timeval r;
g_return_if_fail (result != NULL);
#include <gmodule.h>
#include <stdlib.h>
-#if defined (NATIVE_WIN32) && defined (__LCC__)
-int __stdcall
-LibMain(void *hinstDll,
- unsigned long dwReason,
- void *reserved)
-{
- return 1;
-}
-#endif /* NATIVE_WIN32 && __LCC__ */
-
G_MODULE_EXPORT void
gplugin_a_func (void)
{
#include <gmodule.h>
-#if defined (NATIVE_WIN32) && defined (__LCC__)
-int __stdcall
-LibMain(void *hinstDll,
- unsigned long dwReason,
- void *reserved)
-{
- return 1;
-}
-#endif /* NATIVE_WIN32 && __LCC__ */
-
G_MODULE_EXPORT const gchar*
g_module_check_init (GModule *module)
{
gboolean g_thread_use_default_impl = TRUE;
gboolean g_threads_got_initialized = FALSE;
-GThreadFunctions g_thread_functions_for_glib_use = {
+GUTILS_C_VAR GThreadFunctions g_thread_functions_for_glib_use = {
(GMutex*(*)())g_thread_fail, /* mutex_new */
NULL, /* mutex_lock */
NULL, /* mutex_trylock */
else
g_thread_use_default_impl = FALSE;
+#if defined (WIN32) && defined (__GNUC__)
+ memcpy(&g_thread_functions_for_glib_use, init, sizeof (*init));
+#else
g_thread_functions_for_glib_use = *init;
-
+#endif
/* It is important, that g_threads_got_initialized is not set before the
* thread initialization functions of the different modules are called
*/
const guint glib_interface_age = GLIB_INTERFACE_AGE;
const guint glib_binary_age = GLIB_BINARY_AGE;
-#if defined (NATIVE_WIN32) && defined (__LCC__)
-int __stdcall
-LibMain (void *hinstDll,
- unsigned long dwReason,
- void *reserved)
-{
- return 1;
-}
-#endif /* NATIVE_WIN32 && __LCC__ */
-
void
g_atexit (GVoidFunc func)
{
#endif /* Old IO Channels */
#ifdef NATIVE_WIN32
-#ifdef _MSC_VER
int
gwin_ftruncate (gint fd,
return 0;
}
-#endif /* _MSC_VER */
-
#endif /* NATIVE_WIN32 */
--- /dev/null
+## Makefile for building the GLib, gmodule and gthread DLLs with
+## egcs on cygwin.
+## Use: make -f makefile.cygwin install
+
+# Change this to wherever you want to install the DLLs. This directory
+# should be in your PATH.
+BIN = /bin
+
+# This is the location of pthreads for Win32,
+# see http://sourceware.cygnus.com/pthreads-win32/
+PTHREADS = ../pthreads-snap-1999-04-07
+PTHREAD_LIB = -L$(PTHREADS) -lpthread
+PTHREAD_INC = -I $(PTHREADS)
+
+################################################################
+
+# Nothing much configurable below
+
+CC = gcc -mno-cygwin -mpentium
+
+CP = cp
+LD = ld
+DLLTOOL = dlltool
+INSTALL = install
+
+GLIB_VER = 1.3
+
+CFLAGS = -g -O2 -I. -DHAVE_CONFIG_H
+
+all : \
+ glibconfig.h \
+ config.h \
+ glib-$(GLIB_VER).dll \
+ gthread-$(GLIB_VER).dll \
+ gmodule/gmoduleconf.h \
+ gmodule-$(GLIB_VER).dll \
+ testglib.exe \
+ testgmodule.exe \
+ testgdate.exe \
+ testgdateparser.exe \
+ testgthread.exe
+
+install : all
+ $(INSTALL) glib-$(GLIB_VER).dll $(BIN)
+ $(INSTALL) gmodule-$(GLIB_VER).dll $(BIN)
+ $(INSTALL) gthread-$(GLIB_VER).dll $(BIN)
+
+glib_OBJECTS = \
+ garray.o \
+ gcache.o \
+ gcompletion.o \
+ gdataset.o \
+ gdate.o \
+ gerror.o \
+ ghook.o \
+ ghash.o \
+ giochannel.o \
+ giowin32.o \
+ glist.o \
+ gmain.o \
+ gmem.o \
+ gmessages.o \
+ gmutex.o \
+ gnode.o \
+ gprimes.o \
+ gqueue.o \
+ grand.o \
+ gslist.o \
+ gstack.o \
+ gtimer.o \
+ gtree.o \
+ grel.o \
+ gstring.o \
+ gstrfuncs.o \
+ gscanner.o \
+ gutils.o
+
+glib-$(GLIB_VER).dll : $(glib_OBJECTS) glib.def
+ ./build-dll glib $(GLIB_VER) glib.def $(glib_OBJECTS) -lmsvcrt -lkernel32 -luser32 -ladvapi32 -lwsock32
+
+glibconfig.h: glibconfig.h.win32
+ $(CP) glibconfig.h.win32 glibconfig.h
+
+config.h: config.h.win32
+ $(CP) config.h.win32 config.h
+
+.c.o :
+ $(CC) $(CFLAGS) -c -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib $<
+
+gmodule_OBJECTS = \
+ gmodule.o
+
+gmodule-$(GLIB_VER).dll : $(gmodule_OBJECTS) gmodule/gmodule.def
+ ./build-dll gmodule $(GLIB_VER) gmodule/gmodule.def $(gmodule_OBJECTS) -L. -lglib-$(GLIB_VER) -lmsvcrt -lkernel32 -luser32 -ladvapi32 -lwsock32
+
+gmodule.o : gmodule/gmodule.c gmodule/gmodule-win32.c
+ $(CC) $(CFLAGS) -Igmodule -c -DG_LOG_DOMAIN=g_log_domain_gmodule gmodule/gmodule.c
+
+gmodule/gmoduleconf.h: gmodule/gmoduleconf.h.win32
+ $(CP) gmodule/gmoduleconf.h.win32 gmodule/gmoduleconf.h
+
+gthread_OBJECTS = \
+ gthread.o
+
+gthread-$(GLIB_VER).dll : $(gthread_OBJECTS) glib-$(GLIB_VER).dll gthread/gthread.def
+ ./build-dll gthread $(GLIB_VER) gthread/gthread.def $(gthread_OBJECTS) -L. -lglib-$(GLIB_VER) $(PTHREAD_LIB) -lmsvcrt -lkernel32 -luser32 -ladvapi32 -lwsock32
+
+gthread.o : gthread/gthread.c gthread/gthread-posix.c
+ $(CC) $(CFLAGS) $(PTHREAD_INC) -DG_LOG_DOMAIN=\"GThread\" -c gthread/gthread.c
+
+testglib.exe : glib-$(GLIB_VER).dll testglib.o
+ $(CC) $(CFLAGS) -o testglib testglib.o -L. -lglib-$(GLIB_VER) -lmsvcrt $(LDFLAGS)
+
+testglib.o : testglib.c
+ $(CC) -c $(CFLAGS) testglib.c
+
+testgdate.exe : glib-$(GLIB_VER).dll testgdate.o
+ $(CC) $(CFLAGS) -o testgdate.exe testgdate.o -L. -lglib-$(GLIB_VER) -lmsvcrt $(LDFLAGS)
+
+testgdate.o : testgdate.c
+ $(CC) -c $(CFLAGS) testgdate.c
+
+testgdateparser.exe : glib-$(GLIB_VER).dll testgdateparser.o
+ $(CC) $(CFLAGS) -o testgdateparser.exe testgdateparser.o -L. -lglib-$(GLIB_VER) -lmsvcrt $(LDFLAGS)
+
+testgdateparser.o : testgdateparser.c
+ $(CC) -c $(CFLAGS) testgdateparser.c
+
+testgmodule.exe : glib-$(GLIB_VER).dll gmodule-$(GLIB_VER).dll testgmodule.o libgplugin_a.dll libgplugin_b.dll
+# Wow, do we really have to do it like this to get some symbols
+# exported from a .exe? Apparently yes. Does the __declspec(dllexport)
+# actually do anything in egcs-1.1.2?
+ $(CC) $(CFLAGS) -Wl,--base-file,testgmodule.base -o testgmodule.exe testgmodule.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) -lmsvcrt $(LDFLAGS)
+ $(DLLTOOL) --base-file testgmodule.base --output-exp testgmodule.exp testgmodule.o
+ $(CC) $(CFLAGS) -Wl,--base-file,testgmodule.base,testgmodule.exp -o testgmodule.exe testgmodule.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) -lmsvcrt $(LDFLAGS)
+ $(DLLTOOL) --base-file testgmodule.base --output-exp testgmodule.exp testgmodule.o
+ $(CC) $(CFLAGS) -Wl,testgmodule.exp -o testgmodule.exe testgmodule.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) -lmsvcrt $(LDFLAGS)
+
+testgmodule.o : gmodule/testgmodule.c
+ $(CC) $(CFLAGS) -Igmodule -c gmodule/testgmodule.c
+
+libgplugin_a.dll : libgplugin_a.o
+ ./build-dll libgplugin_a - - libgplugin_a.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) -lmsvcrt
+
+libgplugin_a.o : gmodule/libgplugin_a.c
+ $(CC) $(CFLAGS) -Igmodule -c gmodule/libgplugin_a.c
+
+libgplugin_b.dll : libgplugin_b.o
+ ./build-dll libgplugin_b - - libgplugin_b.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) -lmsvcrt
+
+libgplugin_b.o : gmodule/libgplugin_b.c
+ $(CC) $(CFLAGS) -Igmodule -c gmodule/libgplugin_b.c
+
+testgthread.exe : glib-$(GLIB_VER).dll gthread-$(GLIB_VER).dll testgthread.o
+ $(CC) $(CFLAGS) -o testgthread.exe testgthread.o -L. -lglib-$(GLIB_VER) -lgthread-$(GLIB_VER) $(PTHREAD_LIB) $(LDFLAGS)
+
+testgthread.o : gthread/testgthread.c
+ $(CC) $(CFLAGS) $(PTHREAD_INC) -c gthread/testgthread.c
+
+clean:
+ -rm config.h
+ -rm glibconfig.h
+ -rm gmodule/gmoduleconf.h
+ -rm *.exe
+ -rm *.o
+ -rm *.dll
+ -rm *.a
+ -rm *.base
+ -rm *.exp
# This is the location of pthreads for Win32,
# see http://sourceware.cygnus.com/pthreads-win32/
-PTHREAD_LIB = ..\lib\pthread.lib
-PTHREAD_INC = ..\include
+PTHREADS = ..\pthreads-snap-1999-04-07
+PTHREAD_LIB = $(PTHREADS)\pthread.lib
+PTHREAD_INC = -I $(PTHREADS)
################################################################
CC = cl -G5 -GF -Ox -W3 -MD -nologo
# No general LDFLAGS needes
-LDFLAGS = /link
+LDFLAGS = /link
INSTALL = copy
GLIB_VER = 1.3
gmodule_OBJECTS = \
gmodule.obj
-gmodule-$(GLIB_VER).dll : $(gmodule_OBJECTS)
+gmodule-$(GLIB_VER).dll : $(gmodule_OBJECTS) gmodule\gmodule.def
$(CC) $(CFLAGS) -LD -Fegmodule-$(GLIB_VER).dll $(gmodule_OBJECTS) glib-$(GLIB_VER).lib $(LDFLAGS) /def:gmodule\gmodule.def
gmodule.obj : gmodule\gmodule.c gmodule\gmodule-win32.c
gthread_OBJECTS = \
gthread.obj
-gthread-$(GLIB_VER).dll : $(gthread_OBJECTS)
- $(CC) $(CFLAGS) -LD -Fegthread-$(GLIB_VER).dll $(gthread_OBJECTS) glib-$(GLIB_VER).lib $(PTHREAD_LIB) glib-$(GLIB_VER).lib $(LDFLAGS) /def:gthread\gthread.def
+gthread-$(GLIB_VER).dll : $(gthread_OBJECTS) gthread\gthread.def
+ $(CC) $(CFLAGS) -LD -Fegthread-$(GLIB_VER).dll $(gthread_OBJECTS) glib-$(GLIB_VER).lib $(PTHREAD_LIB) $(LDFLAGS) /def:gthread\gthread.def
gthread.obj : gthread\gthread.c gthread\gthread-posix.c
- $(CC) $(CFLAGS) -GD -I$(PTHREAD_INC) -DG_LOG_DOMAIN=\"GThread\" -c gthread\gthread.c
+ $(CC) $(CFLAGS) -GD $(PTHREAD_INC) -DG_LOG_DOMAIN=\"GThread\" -c gthread\gthread.c
testglib.exe : glib-$(GLIB_VER).dll testglib.obj
$(CC) $(CFLAGS) -Fetestglib.exe testglib.obj glib-$(GLIB_VER).lib $(LDFLAGS) /subsystem:console
$(CC) $(CFLAGS) testgthread.obj glib-$(GLIB_VER).lib gthread-$(GLIB_VER).lib $(PTHREAD_LIB) $(LDFLAGS) /subsystem:console
testgthread.obj : gthread\testgthread.c
- $(CC) $(CFLAGS) -I$(PTHREAD_INC) -c gthread\testgthread.c
+ $(CC) $(CFLAGS) $(PTHREAD_INC) -c gthread\testgthread.c
clean:
del config.h
for (i = 0; i < 10000; i++)
g_string_append_c (string1, 'a'+(i%26));
-#if !(defined (_MSC_VER) || defined (__LCC__))
- /* MSVC and LCC use the same run-time C library, which doesn't like
+#ifndef NATIVE_WIN32
+ /* MSVC, mingw32 and LCC use the same run-time C library, which doesn't like
the %10000.10000f format... */
g_string_sprintf (string2, "%s|%0100d|%s|%s|%0*d|%*.*f|%10000.10000f",
"this pete guy sure is a wuss, like he's the number ",
--- /dev/null
+## Makefile for building the GLib test programs with egcs on cygwin.
+## Use: make -f makefile.cygwin check
+
+################################################################
+
+# Nothing much configurable below
+
+# cl -? described the options
+CC = gcc -mno-cygwin -mpentium
+
+# No general LDFLAGS needes
+LDFLAGS = /link
+
+GLIB_VER = 1.3
+
+CFLAGS = -I.. -DHAVE_CONFIG_H
+
+TESTS = \
+ array-test.exe \
+ date-test.exe \
+ dirname-test.exe\
+ hash-test.exe \
+ list-test.exe \
+ node-test.exe \
+ queue-test.exe \
+ rand-test.exe \
+ relation-test.exe\
+ slist-test.exe \
+ stack-test.exe \
+ string-test.exe \
+ strfunc-test.exe\
+ tree-test.exe \
+ type-test.exe
+
+all : $(TESTS)
+
+.SUFFIXES: .c .exe
+
+.c.exe :
+ $(CC) $(CFLAGS) -c $<
+ $(CC) $(CFLAGS) -o $@ $< -L.. -lglib-$(GLIB_VER) -lmsvcrt
+
+check: all
+ @for P in $(TESTS) ; do echo $$P; ./$$P; done
+
+clean:
+ rm *.exe
+ rm *.o
+ rm *.dll
+ rm *.exp
## Makefile for building the GLib test programs with Microsoft C
-## Use: nmake -f makefile.msc all
+## Use: nmake -f makefile.msc check
################################################################
# No general LDFLAGS needes
LDFLAGS = /link
-INSTALL = copy
GLIB_VER = 1.3
g_assert((strlen("hi pete!") + 10000) == string1->len);
g_assert((strlen("hi pete!") + 10000) == strlen(string1->str));
-#if !(defined (_MSC_VER) || defined (__LCC__))
- /* MSVC and LCC use the same run-time C library, which doesn't like
+#ifndef NATIVE_WIN32
+ /* MSVC and mingw32 use the same run-time C library, which doesn't like
the %10000.10000f format... */
g_string_sprintf (string2, "%s|%0100d|%s|%s|%0*d|%*.*f|%10000.10000f",
"this pete guy sure is a wuss, like he's the number ",
for (i = 0; i < 10000; i++)
g_string_append_c (string1, 'a'+(i%26));
-#if !(defined (_MSC_VER) || defined (__LCC__))
- /* MSVC and LCC use the same run-time C library, which doesn't like
+#ifndef NATIVE_WIN32
+ /* MSVC, mingw32 and LCC use the same run-time C library, which doesn't like
the %10000.10000f format... */
g_string_sprintf (string2, "%s|%0100d|%s|%s|%0*d|%*.*f|%10000.10000f",
"this pete guy sure is a wuss, like he's the number ",