[SciPy-dev] Is it ok to depend on ctypes for scipy code ?

David Cournapeau david at ar.media.kyoto-u.ac.jp
Wed Jun 13 23:44:18 EDT 2007


Robert Kern wrote:
> David Cournapeau wrote:
>> Mmh, do you mean building a library with  
>>
>> config.add_extension('foo',                                                        
>>
>>         sources=[join('src', 'vq.c') ])
>>
>> is not enought to load it through ctypes on windows ?
>
> Correct. It will not even build.
>
But if this does not build, this means either a C compiler is not 
available, or the C api for python is not there, right ? So this means 
scipy has to be 100 % python code ? I start to feel like an idiot, but I 
really don't get it: scipy.stats depends on add_extension, as does 
fftpack, etc... And this is not optional. If the above foo does not 
work, how can fftpack work ?

To answer your other email: I have a small, self contained (eg does not 
depend on anything else than the C runtime) C library, wrapped by eg 
swig. Eg:

#include <stdio.h>
int foo()
{
printf("foo\n");
return 0;
}

What makes it different to wrap it with ctypes than with swig, or pure C 
extension ?

David



More information about the SciPy-Dev mailing list