Re: gtk_file_chooser page faults (win32)



Tor Lillqvist wrote:

Yes, but at least when I last checked, you don't get the Win32
API headers or import libraries, nor import libraries for the
msvcrt.dll C library (runtime), which is what is bundled with
the operating system. Nor is there any guarantee, AFAIK, that
the C headers included with this compiler, which correspond to
the static C library that they include with it, even match
what's in msvcrt.dll.


True enough, but it seems to me the purpose of the VC++ toolkit is
to push .NET and Windows Forms programming with C++ and its new
Managed Extensions (i.e. garbage collection et al). In any case,
all of this is academic, because I've got the OP's code snippet
(with minor modifications) up and running without any crashes.

All in all, I would say that Microsoft giving away their
compiler for free is very interesting, but not quite enough yet
to make me consider using it instead of gcc (assuming one could
make libtool work with it). And I really would like somebody
who understands lawyerspeak to read the license and make sure
there are no clauses preventing the use of the toolkit to build
Free or Open Source software, or software that competes with
Microsoft's products, for instance...

I completely agree. Not to be used for production software.
However, for testing purposes, it's great to have the option.

Anyway, here's my version of the OP's code snippet -- formatting's probably lousy, sorry:

/* gtktest2.c ***************************************************/
#include <stdlib.h> /* Needed for __argc and __argv since WinMain doesn't get them as command-line args -- BTW I lifted this off libgimp.h :-) */
#include <gtk/gtk.h>

struct HINSTANCE__;

gint _stdcall
WinMain(struct HINSTANCE__* hInstance, struct HINSTANCE__* hPrevInstance, gchar* lpszCmdLine, gint nCmdShow) {
    GtkWidget* window;
    GtkWidget* dialog;

    gtk_init(&__argc, &__argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    g_signal_connect(G_OBJECT(window), "destroy",
                     G_CALLBACK(gtk_main_quit), NULL);

dialog = gtk_file_chooser_dialog_new("File Chooser dialog", GTK_WINDOW(window), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);

    gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), "c:\\");
    gtk_dialog_run(GTK_DIALOG(dialog));
    gtk_widget_destroy(dialog);

    return 0;
}
/* **************************************************************/

And here's the batch file I used to compile it (all of it -- except the comments -- is on a single line):

rem go.bat *******************************************************

cl gtktest2.c /Id:\software\gtk_top\include\gtk-2.0 /Id:\software\gtk_top\lib\gtk-2.0\include /Id:\software\gtk_top\include\atk-1.0 /Id:\software\gtk_top\include\pango-1.0 /Id:\software\gtk_top\include\glib-2.0 /Id:\software\gtk_top\lib\glib-2.0\include /link /subsystem:windows d:\software\gtk_top\lib\gtk-win32-2.0.lib d:\software\gtk_top\lib\gdk-win32-2.0.lib d:\software\gtk_top\lib\atk-1.0.lib d:\software\gtk_top\lib\gdk_pixbuf-2.0.lib d:\software\gtk_top\lib\pangowin32-1.0.lib d:\software\gtk_top\lib\pango-1.0.lib d:\software\gtk_top\lib\gobject-2.0.lib d:\software\gtk_top\lib\gmodule-2.0.lib d:\software\gtk_top\lib\glib-2.0.lib d:\software\gtk_top\lib\intl.lib d:\software\gtk_top\lib\iconv.lib

rem **************************************************************

Given, of course, that I installed all the GTK+ libraries in d:\download\gtk_top. Ugly and brutal, I know (sigh), but no crashes :-)

--
Yawar Amin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]