What am I doing wrong with SWIG in OS X Snow Leopard?

Zectbumo alfred at 54.org
Tue Oct 20 05:46:20 EDT 2009


Here are the steps I am doing that cause me to get the error
ImportError: No module named _hi.
I'm running OS X 10.6.1 What am I doing wrong?

mkdir -p /tmp/my_swig_test
cd /tmp/my_swig_test
cat >hi.c<<.
#include <stdio.h>
void hello(void) {printf("Hello World\n");}
.
gcc -shared -o libhi.dylib hi.c
cat >hi.i<<.
%module hi
%include "hi.c"
.
swig -python hi.i
gcc -shared -I/System/Library/Frameworks/Python.framework/Headers -
framework Python -L. -lhi -o _hi.dylib hi_wrap.c
DYLD_LIBRARY_PATH=. python -c 'import hi; hi.hello()'



More information about the Python-list mailing list