After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 353816 - PyGobject signals can't be used from C applications
PyGobject signals can't be used from C applications
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: gobject
Git master
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on: 401080
Blocks: 304361
 
 
Reported: 2006-09-01 10:43 UTC by Edward Hervey
Modified: 2007-04-29 21:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (4.88 KB, patch)
2007-01-28 11:20 UTC, Johan (not receiving bugmail) Dahlin
none Details | Review
v2: conditional C/Invoke and libffi support with autotools-fu included. (9.19 KB, patch)
2007-01-28 14:39 UTC, Johan (not receiving bugmail) Dahlin
none Details | Review

Description Edward Hervey 2006-09-01 10:43:27 UTC
Signals created on PyGObject don't provide a C Marshaller:

    signal_id = g_signal_newv(signal_name, instance_type, signal_flags,
			      pyg_signal_class_closure_get(),
			      accumulator, accum_data,
			      (GSignalCMarshaller)0,
			      return_type, n_params, param_types);

This means we can't connect to those signals from a C application.
Comment 1 Gustavo Carneiro 2006-09-01 10:53:47 UTC
The only way to fix this would be to have a generic marshaller, which would then use libffi to invoke the signal handler.
Comment 2 Edward Hervey 2006-09-01 11:05:39 UTC
I agree on using libffi, I'm checking that right now.
Comment 3 Gustavo Carneiro 2006-09-01 12:25:33 UTC
A solution based on libffi would be generic enough for all programs and all language bindings, including C.  So it probably belongs in GLib.  Code generation for the marshallers would then become redundant.  Also, there's some relation with gobject-introspection: they both need libffi.
Comment 4 Edward Hervey 2006-09-01 16:54:11 UTC
Some people won't agree to using a libffi-based c_marshaller because it requires more computing than hardcoded ones, and is not guaranteed to work on all platforms.
Maybe it could be used if no c_marshaller is specified.
Comment 5 John Ehresman 2006-09-01 18:55:06 UTC
What's the alternative to libffi?
Comment 6 Johan (not receiving bugmail) Dahlin 2007-01-28 11:20:49 UTC
Created attachment 81361 [details] [review]
patch

Inclusion of patch from bug 401080 against pygobject.
Requires C/Invoke which can be fetched from http://www.nongnu.org/cinvoke/
Comment 7 Johan (not receiving bugmail) Dahlin 2007-01-28 14:39:00 UTC
Created attachment 81377 [details] [review]
v2: conditional C/Invoke and libffi support with autotools-fu included.

I'll commit this after we branch for glib 2.14 if there are no objections.
Comment 8 Gustavo Carneiro 2007-04-14 16:29:58 UTC
Comment on attachment 81377 [details] [review]
v2: conditional C/Invoke and libffi support with autotools-fu included.

>Index: gobject/Makefile.am
>===================================================================
>--- gobject/Makefile.am	(revision 636)
>+++ gobject/Makefile.am	(arbetskopia)
>@@ -43,3 +43,11 @@
> if PLATFORM_WIN32
> _gobject_la_CFLAGS += -DPLATFORM_WIN32
> endif
>+
>+if HAVE_LIBFFI
>+_gobject_la_LIBADD += -lffi
>+else 
>+if HAVE_CINVOKE
>+_gobject_la_LIBADD += -lcinvoke
>+endif
>+endif

Needs corresponding .pc.in file changes.
Comment 9 Johan (not receiving bugmail) Dahlin 2007-04-29 21:48:07 UTC
I committed the ffi version of the marshaller.
A ffi snapshot is not included in pygobject, we have an external dependency on it instead.
Ubuntu feisty includes a snapshot of the ffi marshaller which this patch was developed against.

Enviando       ChangeLog
Enviando       README
Enviando       configure.ac
Enviando       gobject/Makefile.am
Adicionando    gobject/ffi-marshaller.c
Adicionando    gobject/ffi-marshaller.h
Enviando       gobject/gobjectmodule.c
Enviando       pygobject-2.0.pc.in
Enviando       tests/test_signal.py
Enviando       tests/testhelpermodule.c
Transmitindo dados do arquivo ..........
Commit da revisão 651.