[SciPy-user] [Nipy-devel] how to wrap C++

Robert Kern robert.kern at gmail.com
Sat Jan 27 17:30:17 EST 2007


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?

The problem is the location of installation. Under Windows, it's not really a
problem; you just put the DLL next to the .pyd that links against it. DLL
resolution looks in the directory of linking DLL first. Linux and other Unices
don't do this. You have to install the .so to a location where it will be picked
up by the linker. distutils does not really support that. You have to extend it
to do so as in the Togl example that you show.

Thus, "not easy".

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco



More information about the SciPy-User mailing list