[Pythonmac-SIG] Writting C extension in Mac os X tiger

Jaonary Rabarisoa jaonary at free.fr
Thu Oct 27 21:37:16 CEST 2005


Hi all,


I'm trying to write a C++ function that I can use with python. The  
sample code below works well under windows and linux but not under  
mac os x tiger :


#include "Python.h"

static PyObject * mHarrisDetector(PyObject *self, PyObject *args)
{

     //Parse the args
     const int N = 5;
     const float eta = sqrt(2.f);
     const float sigma_0 = 1.f;
     const char* img_file;

     int ok = PyArg_ParseTuple(args, "s|ffi", &img_file, &sigma_0,  
&eta,&N);

     printf("%s %f %f %d \n",img_file,sigma_0,eta,N);

     Py_INCREF(Py_None);
     return Py_None;
}

static PyMethodDef PyIFFD_methods[] = {
     {"mHarrisDetector",
       mHarrisDetector,
       METH_VARARGS,
       "mHarrisDetector(image,sigma 0,eta,N) -> Array of Harris Point"},

     {NULL, NULL}
};

extern "C"
void initPyIFFD(void)
{
     Py_InitModule("PyIFFD", PyIFFD_methods);
}



To build this code I created a BDS dynamic library with Xcode.  While  
loading the module I get this error :

 >>> import PyIFFD
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap


So what I've missed ?

Thanks a lot for your help.


Jaonary Rabarisoa
jaonary at free.fr




More information about the Pythonmac-SIG mailing list