Calling Python from C

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
igorgatis
Posts: 21
Joined: Thu Nov 19, 2015 1:10 pm

Calling Python from C

Post by igorgatis » Wed Dec 23, 2015 6:30 pm

Say I have a call like

Code: Select all

def bar(result):
    print(result)

def foo():
  nativemodulex.call(bar)

foo()
What the C code for nativemodulex.call look like?

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Calling Python from C

Post by dhylands » Wed Dec 23, 2015 6:51 pm

Code: Select all

mp_obj_t call_func(mp_obj_t fn) {
    return mp_call_function_0(fn);
}

Post Reply