469,336 Members | 5,248 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

extending python

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.
Jul 18 '05 #1
1 1708
Ajay <ab******@mail.usyd.edu.au> writes:
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


How are you compiling it? Where is the DLL?

Cheers,
mwh

--
: exploding like a turd
Never had that happen to me, I have to admit. They do that
often in your world? -- Eric The Read & Dave Brown, asr
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Alicia Haumann | last post: by
1 post views Thread by Richard Townsend | last post: by
3 posts views Thread by Marco Meoni | last post: by
5 posts views Thread by vbgunz | last post: by
3 posts views Thread by Redefined Horizons | last post: by
1 post views Thread by jeremito | last post: by
7 posts views Thread by Maximus Decimus | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by haryvincent176 | last post: by
reply views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.