2

I have some code written in c that i want to call from python. Is there a way to do this. I looked at several documentations but they look quite vague. Can some one give me some specific steps please

Edit:

I wrote below dll called djj.dll it has a file called try.cpp with following code

#include<stdio.h>

int print(){

return 4;

}

Now, i build this dll and go to python idle.

I type print windll.djj.print . It gives syntax error .WHY??

3
  • stackoverflow.com/questions/145270/calling-c-c-from-python Commented Sep 17, 2011 at 15:25
  • The easiest way is with ctypes. The ctypes tutorial is excellent. Commented Sep 17, 2011 at 15:27
  • I don't think this is a duplicate. print is a reserved word in Python 2.X (Python 3 changes it to an ordinary predefined function). What happens if you change the name of your C function from print to, say, Print? Commented Sep 17, 2011 at 19:28

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.