Re: Gtk2::Image on win32 (Was Gtk2::Gdk::Pixbuf on win32)



Well, here's what I got when running it through OllyDbg.

It runs like:
call perl510.Perl_get_context
call perl510.Perl_Istack_base_ptr
call Glib.gperl_filename_from_sv (After which EAX points to a memory location that correctly contains the image name)
Then it gets moved to EDX, which is then pushed onto the stack
call libgtk-win32-2.0-0.gtk_image_new_from_file_utf8
call libgtk-win32-2.0-0.gtk_object_get_type
call libgobject-2.0-0.g_type_check_instance_cast
... (More perl specific calls)

In C, the call stack (specifically the relevant ones) is:
call libgtk-win32-2.0-0.gtk_image_new_from_file_utf8
call libgtk-win32-2.0-0.gtk_container_get_type
call libgobject-2.0-0.g_type_check_instance_cast

I see that in perl it calls gtk_container_get_type instead of gtk_object_get_type, not sure if that makes a difference, though.

Also, after calling gtk_image_new_from_file_utf8, eax seems to contain a pointer to a memory location. The data pointed to by eax is very similar, though not identical in both cases.

LastErr stays 0 after making all of the relevant calls, is there anything else I should be specifically be looking for?

I've attached the two sources just in case the slight discrepancies could be explained by differences in the code?

Thanks for your help.

T.J.

muppet wrote:

On Mar 20, 2008, at 2:06 AM, T.J. Ferraro wrote:
Been kind of busy, but back on track now. Instead of reviving this via
Gtk2::Gdk::Pixbuf, I figured I'd try to get Gtk2::Image working
considering I know from compiling a C program the libraries are working
on win32. (Whereas I could not get the Pixbuf stuff working in C on win32)

This is really starting to sound like a runtime path problem; perhaps gtk+ can't find its modules when run from your perl script? Can you run in a C debugger to try it?

http://www.perlmonks.org/?node_id=671479).

That mentions some grief getting symbols resolved, and asks if the Makefile.PL shouldn't take care of that. Makefile.PL *does* take care of that, for the MSVC toolchain -- the find_extra_libs() subroutine at the bottom. It only looks for .lib files, though. We'll gladly accept patches to make this work with mingw, too.


--
I hate to break it to you, but magic data pixies don't exist.
  -- Simon Cozens
#include <gtk/gtk.h>

gint delete_event(GtkWidget *widget, GdkEvent  *event, gpointer data)
{
        gtk_main_quit ();
        return TRUE;
}

void destroy(GtkWidget *widget, gpointer data)
{
    gtk_main_quit ();
}

int main(int argc, char *argv[])
{
        GtkWidget *image;
        GtkWidget *window;
        
        gtk_init (&argc, &argv);
        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (delete_event), NULL);
        g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy), NULL);
        
        image = gtk_image_new_from_file ("image.bmp");
        gtk_container_add (GTK_CONTAINER (window), image);
        gtk_widget_show (image);
        gtk_widget_show (window);
        
        gtk_main ();
        return 0;
}
use Glib qw/TRUE FALSE/;
use Gtk2 '-init';

$mw = Gtk2::Window->new('toplevel');
$mw->signal_connect(destroy => sub { Gtk2->main_quit; });

$image = Gtk2::Image->new_from_file('image.bmp');

$mw->add($image);
$mw->maximize;
$mw->show_all;
Gtk2->main();


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