extending python

Ajay abra9823 at mail.usyd.edu.au
Sat Sep 4 00:45:23 EDT 2004


hi!

i have written simple C file and am now trying to call it from Python
the file is pasted below.
I can compile it to testdll.dll but when i call it from Python, i get an
import error: No module named testdll

what am i doing wrong

thanks

cheers


#include <Python.h>

static PyObject*
test_dll(PyObject *self, PyObject *args)
{
	char *command;
	int sts;

	if (!PyArg_ParseTuple(args, "s", &command))
		return NULL;
	sts = 5;
	return Py_BuildValue("i", sts);
}

static PyMethodDef testdllMethods[] = {
	{"system", test_dll, METH_VARARGS, "test a dll."},
	{NULL, NULL, 0, NULL}
};

PyMODINIT_FUNC
inittestdll(void)
{
	(void) Py_InitModule("testdll", testdllMethods);
}





----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the Python-list mailing list