Dynamic loading of c modules,question.

hpyhpy member at dbforums.com
Fri Sep 13 05:37:36 EDT 2002


hi,everybody:

I'm puzzled about SWIG.

On sco openserver5,I try swig's example:

/****************************/
example.c

/* File : example.c */

/* A global variable */
double Foo = 3.0;

/* Compute the greatest common divisor of positive integers */
int gcd(int x, int y) {
int g;
g = y;
while (x > 0) {
g = x;
x = y % x;
y = g;
}
return g;
}
/****************************/
example.i

/* File : example.i */
%module example

extern int    gcd(int x, int y);
extern double Foo;
/****************************/
And I do :
#gcc -c example.c
#swig -python example.i
#gcc -c example_wrap.c -I/usr/local/include/python2.2/
#gcc -G -Wl example.o example_wrap.o -o _examplecmodule.so

Then it has these files:
example.c
example.i
example.o
example_wrap.c
example_wrap.doc
example_wrap.o
_examplecmodule.so

So I wonder where is the "example.py"???
So I can't "import example"

Traceback (most recent call last):
File "", line 1, in ?
ImportError: No module named example

*_*   *_*   *_*

Who can tell me why,please help me,I'm a tyro^_^
Thank!

--
Posted via http://dbforums.com




More information about the Python-list mailing list