SWIG /Python problem
Andrew Gregory
andrew.gregory at npl.co.uk
Mon Nov 11 10:37:05 EST 2002
In case anyone's interested one solution is to rename the compiled
.pyd file with a preceding underscore (i.e. for SWIG 1.3.11 use
filename pysimple.pyd, for SWIG 1.3.16 use _pysimple.pyd). For 1.3.16
the correct .def file is
LIBRARY PYSIMPLE
EXPORTS
init_pysimple = _init_pysimple
DESCRIPTION 'Simple Python DLL'
EXETYPE WINDOWS
CODE MOVEABLE
DATA MOVEABLE MULTIPLE
HEAPSIZE 1024
Alteratively the wrapper file can be edited.
For this test the C header file pysimple.h is
extern int mysquare(int i)
{
return i*i;
};
and the interface file pysimple.i is
%module pysimple
%{
#include "pysimple.h"
%}
%include pysimple.h
Does anyone know why 1.3.16 adds a preceding underscore to SWIG_name,
or (better) if there is a directive for setting SWIG_name from inside
the interface file?
Andrew.
More information about the Python-list
mailing list