Почему SWIG аварийно завершает работу Python, когда он связан с gtkglext? - PullRequest
1 голос
/ 26 ноября 2009

Все, что я указываю на gtkglext с помощью SWIG, приводит к сбою Python при выходе. Почему происходит сбой?

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

Есть идеи? Спасибо ...

1 Ответ

1 голос
/ 26 ноября 2009

Вам нужно правильно инициализировать 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.
...