SWIG for Win95/Python1.5.2

moonseeker at my-deja.com moonseeker at my-deja.com
Tue Nov 9 03:50:37 EST 1999


Hi!

I tried to compile the example (renamed as test1) in the SWIG introduction:

/* File : test1.c */
double My_variable = 3.0;
/* Compute factorial of n */
int fact(int n)
  {
  if (n <= 1) return 1;
  else return n*fact(n-1);
  }
/* Compute n mod m */
int my_mod(int n, int m)
  {
  return(n % m);
  }

I generated the test1.i as shown in the intro, ran SWIG:

swig -python test1.i

then compiled and linked it with MSVC 6.0:

cl test1.c test1_wrap.c
link /dll test1.obj test1_wrap.obj /out:test1module.pyd

It compiled and linked correct, but if I try to import it in Python 1.5.2:

>>> import test1module
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ImportError: dynamic module does not define init function (inittest1module)

The same error (but inittest1) appears if the output from link is not
test1.pyd but test1module.pyd

What is wrong?
I hope you can help me with that.

Thanks in advance,
Mike


Sent via Deja.com http://www.deja.com/
Before you buy.




More information about the Python-list mailing list