使用SWIG链接到gtkglext的任何内容都会在退出时崩溃。为什么这会崩溃?
test.i:
%module test
%{
void test() { printf("Test.\n"); }
%}
void test();
会话:
$ swig -python test.i
$ g++ -I/usr/include/python2.6 -shared -fPIC -o _test.so test_wrap.c -lpython2.6
$ python -c 'import test; test.test()'
Test.
$ g++ -I/usr/include/python2.6 -shared -fPIC -o _test.so test_wrap.c -lpython2.6 `pkg-config --libs gtkglext-1.0`
$ python -c 'import test; test.test()'
Test.
Segmentation fault
有什么想法吗?感谢...
答案 0 :(得分:1)
你需要正确地初始化gtk。
$ cat test.i
%module test
%{
void test() { printf("Test.\n"); }
%}
void test();
$ swig -python test.i ; gcc -I/usr/include/python2.5 -shared -fPIC -o _test.so test_wrap.c -lpython2.5 `pkg-config --libs gtkglext-1.0`
$ python -c 'import test; test.test()'
Test.
Segmentation fault
$ python -c 'import gtk; import test; test.test()'
Test.