Re: Gtk2-Perl questions...



Brett Kosinski said:
I had a couple of questions regarding the Gtk2 Perl bindings.  I'm looking
into implementing a set of GStreamer bindings, and because GStreamer uses
the GLib (object heirarchy, etc), it would be necessary for me to create
bindings for a lot of the GLib stuff.  However, the Gtk2 bindings already do
a lot of this (GObject, GSignal, etc), so it seems silly to
re-implement or copy this stuff.  So, my main question is, has there been
any talk of creating a separate GLib binding library, which could then be
shared by other packages like GStreamer and Gtk2?

already done in the gtk2-perl-xs tree.  see the sourceforge releases page, i
just released Glib-Perl-0.20 ---- exactly what you want.

if you want help getting started on a binding, just email me off-list.  i'll
compile our discussions for a good document, rather than just spam the list.



Another question, I noticed on the site that you might switch to XS from
Inline.  I was wondering what the reasons were for this?  After having
looked at the Perl/Gtk stuff and comparing it to the Gtk2 bindings, it seems
the Inline approach is FAR cleaner.  Thus, I was thinking of mirroring this
approach for the GStreamer stuff (plus, I can reuse some of your code).
However, I'd hate to go down that road only to find out that there are
serious drawbacks to the Inline approach.

for your own sanity, don't do it!

after having tried to work in a sensible way with the Inline stuff, i
discovered the contrary -- that XS is far cleaner.   i wrote quite a lot about
this exact issue when i posted the original bit of code justifying the switch;
you can find the original document at

   http://asofyet.org/muppet/software/gtk2-perl/new-gtk2-perl.html

and a slightly updated one in CVS.

that document goes into detail about the methodology of the bindings,
important from a binding developer's point of view.  near the end i explain
why Inline is a bad idea for this.  i've heard reports that the XS-based
bindings load faster and use less ram than the Inline stuff; i attribute this
to the fact that the Inline stuff requires dozens of disk hits on load but xs
only one, and that the Inline stuff bloats the codespace by creating wrappers
for wrappers.

using perl 5.8.0, many XS definitions can be simply C prototypes.  aside from
that, we have some tools to create a first pass of bindings, and there's
plenty of example code.  trust me, you'll save a lot of time going with XS.

-- 
muppet <scott at asofyet dot org>





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