[Glade-users] libglade - connecting signals
Dean Schumacher
dean.schumacher@usa.alcatel.com
Wed, 28 Feb 2001 08:56:39 -0600
Andrae,
Thanks for the info. I was wondering whether this might have
something to do with gmodule because I read something about
that in the Libglade Reference Manual.
However, the little sample program that I'm using is really
just C code compiled with a C++ compiler because I was trying
to demonstrate that I could use Libglade with C++. If I compile
it with a C compiler I still have the same problem. So I'm
left where I started.
BTW, do you know where I could look to get some info on
how to add C++ name-mangling support to gmodule? This
doesn't sound very trivial.
Regards,
Dean
Andrae Muys wrote:
>
> Dean Schumacher wrote:
> >
> > Hello.
> >
> > I've been trying to use Libglade to automatically connect signal
> > handlers in my C++ code, but the glade_xml_signal_autoconnect
> > function is not working.
> >
> > So I decided to try to connect the signal handlers manually
> > using glade_xml_signal_connect (instead of autoconnect) as
> > shown:
> >
> > glade_xml_signal_connect(xml, "on_about1_activate",
> > GTK_SIGNAL_FUNC(on_about1_activate));
> >
> > This doesn't work either. I get no error message, but the
> > signal handler isn't connected. Selecting the Help->About
> > menu option does nothing, when it should be calling my
> > signal handler to display a Help About window.
> >
> > Does anyone have any ideas on what could be wrong with my
> > environment or what libraries might not be built with the
> > correct support, or whatever. I have no idea where to look.
> >
> Ahhh I was going to reply to this the other day, but I ran out of time.
>
> I would guess that you are being caught out by C++'s name mangling.
> libglade's introspection is based on gmodule, which is based on libdl.
> This allows you to search the current processes symbol table for a given
> symbol and extract the associated pointer reference. All very funky and
> cool, and I'm using the same facilities in developing the plugin
> infrastructure for Glade. However there is a problem, in that the
> mapping between a C function and it's symbol is very simple (prepend a
> _), whereas the name mangling for C++ is a awful mess.
>
> So effectively what this means is, you either have to add C++
> name-mangling support to gmodule (and possibly libdl), or you can only
> dynamically connect to functions using C linkage. It's been a while
> since I did any C++ at all, however I believe you do this by enclosing
> the signature (and function?) with extern "C" { ... } blocks.
>
> Anyway, I remember you still had a problem with the C code I sent you so
> there maybe an additional problem unrelated to this.
>
> Andrae Muys
Alcatel USA