pocho | 2 Jun 19:35
Picon
Gravatar

GTK and libraries loading in Windows


Hi again, this is a fork of the other post, specifically refered to
Gtk and libraries loading

As we said...

> > > > > All this was in order to make it work in Windows XP[...]
>
> > I think you might have been the first to try gtk on windows. It's
> > fairly new code
>
> Well, it seems to be almost working. I've been investigating a bit
> more... in src/ui/glib/lib.slate we have
>
> GLib define: #Lib -> (
>         ExternalInterface newForLibrary: 'glib-wrapper' primitives: #(
>                 (Void wrapper_g_object_connect_to_block_id(Pointer CString Int))"
>
>                 (Void wrapper_g_callback_queue_init())
>                 (Void wrapper_g_callback_queue_shutdown())
>                 (Pointer wrapper_g_callback_wait_next())
>                 (Void wrapper_g_callback_end(Pointer))
>                 (Int wrapper_g_callback_data_get_block_id(Pointer))
>                 (Int wrapper_g_callback_data_get_parameter_count(Pointer))
>                 (Pointer wrapper_g_callback_data_get_parameter_at(Pointer Int))
>
>                 (Boolean wrapper_g_type_is_fundamental(Int))
>                 (Int wrapper_g_type_fundamental(Int))
>                 (Int wrapper_g_type_from_instance(Pointer))
>                 (CString g_type_name(Int))
> ...
>
> Notice that loading fails when loading the first pure glib function
> (not wrappers, last line pasted), g_type_name, which makes me think it
> could load all wrappers, but then (I don't know why) searches glib-
> wrapper dll for g_type_name instead of looking in the correct place
> (gobject dll). Maybe there's a difference in steps needed to be
> carried when loading libraries needed by other libraries in Windows.
>

well... I think I found the answer. By debuggin slate in VS, I found
that my predictions were true. Slate is able to find glib-wrapper.dll
and even load all functions defined in glib-wrapper.c. The problem
comes from a diference of how symbols are searched in windows and
linux (done in external-library.c, lookupExternalLibraryPrimitive
(...)),

in line 83 you have

#ifdef WIN32
  fn = (void *) GetProcAddress(h, symbol);
#else
  fn = (void *) dlsym(h, symbol);
#endif

the problem is that, as you can read here,
http://www.opengroup.org/onlinepubs/009695399/functions/dlsym.html,
"... The dlsym() function shall search for the named symbol in all
objects loaded automatically as a result of loading the object
referenced by handle ."

but GetProcAddress used in windows doesn't (I wasn't able to find some
parametrized version to do this), so when you call GetProcAddress(glib-
wrapper handle, "g_type_name"), it just searches glib-wrapper.dll and
fails.

well.. I don't know how to solve this problem, but at least I think
I've given you a good enough description so that someone could fix it.
Also, I can send you the projects I had to create in VS to generate
the wrappers' dlls.

Bye.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "slate-language" group.
To post to this group, send email to slate-language <at> googlegroups.com
To unsubscribe from this group, send email to slate-language+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/slate-language?hl=en
-~----------~----~----~----~------~----~------~--~---


Gmane