Re: Problem in connecting signal handler with gtk_builder in C++ code
- From: "Milosz Derezynski" <internalerror gmail com>
- To: "PT SWing" <pentie gmail com>
- Cc: gtk-list gnome org
- Subject: Re: Problem in connecting signal handler with gtk_builder in C++ code
- Date: Mon, 1 Dec 2008 21:18:56 +0100
The symbols must be non-mangled (look up C++ symbol mangling on Google), or, but this is really only theoretical, you would need to provide the already mangled symbol names to Builder. However, while theoretically not impossible, this is highly unpractical (and by highly i mean you really, really don't want to go there).
Your solution is to have the functions in question having C linkage: prefix them with:
extern "C"
in the source code, e.g.
extern "C" void some_callback (.....)
....
M.
2008/12/1 PT SWing
<pentie gmail com>
Hi, all:
I knew gtk+ was a C builded technic, but now i have to use it in C++ codes, and the problem i encountered is that, i use gtk_builder_connect_signals to connect all the widgets from the xml to the handler function, just as what micahcarrick's tutorial do in C, and complied and link it with -export-dynamic,
$ g++ entry.cpp `pkg-config --libs --cflags gtk+-2.0` -export-dynamic
no problem happens.
But when i run it, the program just couldn't find the handler function, reporting :
pentie pentie-desktop:~/Programming/linux/entry$ ./a.out
(a.out:12605): Gtk-WARNING **: Could not find signal handler 'on_window_destroy'
(a.out:12605): Gtk-WARNING **: Could not find signal handler 'on_exit_clicked'
(a.out:12605): Gtk-WARNING **: Could not find signal handler 'on_add_clicked'
^C
I knew there must be something different with the g++ linker and the -export-dynamic, but i have no clue how to solve this.
Thanks so much if anyone could give me a hand on this. thanks
ps: a simple test code was in the attach file. you will find that the c_style code works very well, but not the cpp one.........
_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list
--
Please note that according to the German law on data retention,
information on every electronic information exchange with me is
retained for a period of six months.
[Bitte beachten Sie, dass dem Gesetz zur Vorratsdatenspeicherung zufolge
jeder elektronische Kontakt mit mir sechs Monate lang gespeichert wird.]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]