[SciPy-user] [Nipy-devel] how to wrap C++
Stefan van der Walt
stefan at sun.ac.za
Sat Jan 27 17:09:50 CST 2007
On Sat, Jan 27, 2007 at 04:32:18PM -0600, Robert Kern wrote:
> Stefan van der Walt wrote:
> > On Sat, Jan 27, 2007 at 01:39:50AM -0700, Travis Oliphant wrote:
> >> It still depends a little. A large library is probably more easily
> >> handled with SWIG, but for custom interfaces I would say ctypes is best.
> >> The only problems with ctypes are
> >> 1) Not easy to distribute the source code with the interface as you
> >> can't use distutils out of the box for building shared libraries.
> > I've heard this being said many times, but I'm not sure I understand.
> > I've built shared libraries under Linux, and I've seen people do it
> > under Windows. Is there a problem under MacOSX or Solaris platforms?
> Actually, let me back up. With ctypes, we want the .so/.dll to go into the
> package rather than being installed anywhere. You still have to extend distutils
> do a build of a non-Python .so and then to put it in the right
Why do you specifically have to build a non-Python .so? Ctypes
doesn't seem to mind.
My setup.py for my extentions directory looks like this:
from os.path import join, dirname
from glob import glob
def configuration(parent_package='', top_path=None, package_name='ext'):
from numpy.distutils.misc_util import Configuration
config = Configuration(package_name,parent_package,top_path)
if __name__ == '__main__':
from numpy.distutils.core import setup
It is probably overly simple, so I'd appreciate any feedback on how to
improve it to do the right thing.
More information about the SciPy-user