[Q]An error with my module in C

Jia,Lu Roka100 at gmail.com
Tue Oct 3 06:24:15 CEST 2006


  I wrote a module in C as below, BUT msg() method cannot work

#include <stdio.h>
#include <python2.4/Python.h>

static PyObject *Roka_msg(PyObject *self,PyObject *args)
	printf("Roka Python lib. Version 1.0\n");

static PyObject *Roka_func(PyObject *self,PyObject *args)
	long arg;
		return NULL;
	return Py_BuildValue("l",arg*2);


static struct PyMethodDef functions[]=

void initRoka(void)
python result:
>>>import Roka
Roka Python lib. Version 1.0
Segmentation fault

I throw out a Segmentation fault after display my message.
Can anyone tell me why?


More information about the Python-list mailing list