Calling python functions from C

Nigel Rowe see at signature.invalid
Fri May 12 09:06:55 CEST 2006

robert.differentone at wrote:

> 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 <>

    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. 

        Nigel Rowe
        A pox upon the spammers that make me write my address like..
                rho (snail) swiftdsl (stop) com (stop) au

More information about the Python-list mailing list