diff options
author | Tor Lillqvist <tml@iki.fi> | 2000-08-19 21:46:05 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2000-08-19 21:46:05 +0000 |
commit | 617e17da3fb1033354ba985de90c93b8e4ee6de1 (patch) | |
tree | abdd5bdc50ff43d8df2e884a9eb4efdfbbca59d3 /gtk | |
parent | 41885abc7c911b647826f3cf707b9f70559de102 (diff) | |
download | gtk+-617e17da3fb1033354ba985de90c93b8e4ee6de1.tar.gz |
gdk/gdkimage.h No need any longer on Win32 for the shared memory
2000-08-20 Tor Lillqvist <tml@iki.fi>
* gdk/gdkimage.h
* gdk/win32/gdkimage-win32.c: No need any longer on Win32 for the
shared memory image+pixmap GdkImage type, or
gdk_image_bitmap_new(). They were used in the gdk_imlib port, but
I am dropping that.
* gtk/gtkmain.h: On Win32, use a #define to map gtk_init() to
actually call gtk_init_abi_check(), passing also
sizeof(GtkWindow). Ditto for gtk_init_check().
* gtk/gtk.def
* gtk/gtkmain.c: (gtk_init_abi_check, gtk_init_check_abi_check):
New functions, used to check that the GTK+-using code has been
compiled using the correct compiler and switches. In particular,
with gcc one has to use the -fnative-struct switch as GTK+ is
compiled with that.
Diffstat (limited to 'gtk')
-rwxr-xr-x | gtk/gtk.def | 2 | ||||
-rw-r--r-- | gtk/gtkmain.c | 37 | ||||
-rw-r--r-- | gtk/gtkmain.h | 20 |
3 files changed, 59 insertions, 0 deletions
diff --git a/gtk/gtk.def b/gtk/gtk.def index 7e5c51279b..a0c178fb07 100755 --- a/gtk/gtk.def +++ b/gtk/gtk.def @@ -569,8 +569,10 @@ EXPORTS gtk_image_new gtk_image_set gtk_init + gtk_init_abi_check gtk_init_add gtk_init_check + gtk_init_check_abi_check gtk_input_add_full gtk_input_dialog_get_type gtk_input_dialog_new diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index ae728c81e1..121beb0985 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -194,6 +194,8 @@ static gchar *add_dll_suffix(gchar *module_name) } #endif +#undef gtk_init_check + gboolean gtk_init_check (int *argc, char ***argv) @@ -460,6 +462,9 @@ gtk_init_check (int *argc, return TRUE; } + +#undef gtk_init + void gtk_init (int *argc, char ***argv) { @@ -470,6 +475,38 @@ gtk_init (int *argc, char ***argv) } } +#ifdef G_OS_WIN32 + +static void +check_sizeof_GtkWindow (size_t sizeof_GtkWindow) +{ + if (sizeof_GtkWindow != sizeof (GtkWindow)) + g_error ("Incompatible build!\n" + "The code using GTK+ thinks GtkWindow is of different\n" + "size than it actually is in this build of GTK+.\n" + "On Windows, this probably means that you have compiled\n" + "your code with gcc without the -fnative-struct switch."); +} + +/* These two functions might get more checks added later, thus pass + * in the number of extra args. + */ +void +gtk_init_abi_check (int *argc, char ***argv, int num_checks, size_t sizeof_GtkWindow) +{ + check_sizeof_GtkWindow (sizeof_GtkWindow); + gtk_init (argc, argv); +} + +gboolean +gtk_init_check_abi_check (int *argc, char ***argv, int num_checks, size_t sizeof_GtkWindow) +{ + check_sizeof_GtkWindow (sizeof_GtkWindow); + return gtk_init_check (argc, argv); +} + +#endif + void gtk_exit (gint errorcode) { diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h index dcee5f5efc..08c01c74a5 100644 --- a/gtk/gtkmain.h +++ b/gtk/gtkmain.h @@ -81,8 +81,28 @@ gchar* gtk_check_version (guint required_major, void gtk_init (int *argc, char ***argv); + gboolean gtk_init_check (int *argc, char ***argv); +#ifdef G_OS_WIN32 + +/* Variants that are used to check for correct struct packing + * when building GTK+-using code. + */ +void gtk_init_abi_check (int *argc, + char ***argv, + int num_checks, + size_t sizeof_GtkWindow); +gboolean gtk_init_check_abi_check (int *argc, + char ***argv, + int num_checks, + size_t sizeof_GtkWindow); + +#define gtk_init(argc, argv) gtk_init_abi_check (argc, argv, 1, sizeof (GtkWindow)) +#define gtk_init_check(args, argv) gtk_init_check_abi_check (argc, argv, 1, sizeof (GtkWindow)) + +#endif + void gtk_exit (gint error_code); gchar* gtk_set_locale (void); gchar* gtk_get_default_language (void); |