472,143 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 software developers and data experts.

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 1760
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 Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.