Calling python functions from C

  • Thread starter robert.differentone
  • Start date
R

robert.differentone

I am a newbie to Python. I want to call python functions from C. I
looked for examples but I couldn't get any simple one. Lets say my
python code is :
def add(a,b)
return (a+b)

I want to call add from C. Could anybody please help me? Thanks in
advance.

R.
 
N

Nigel Rowe

I am a newbie to Python. I want to call python functions from C. I
looked for examples but I couldn't get any simple one. Lets say my
python code is :
def add(a,b)
return (a+b)

I want to call add from C. Could anybody please help me? Thanks in
advance.

R.

You might look at elmer <http://elmer.sourceforge.net/>

Quote:
What is elmer?
Elmer is a tool which embeds a Python module into a C, C++, or Tcl
application. The embedded Python module is used just as if it was
written in the same language as the application itself, without
requiring any knowledge of the Python/C API.

Elmer generates "glue" code that embeds an interpreter for one type of
language into an extension for another. Elmer allows function calls and
various data types, both native and custom, to pass transparently
between the two languages.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,297
Messages
2,571,529
Members
48,240
Latest member
เพิ่มไลค์|LikePro

Latest Threads

Top