Page 1 of 1

Calling Python from C

Posted: Wed Dec 23, 2015 6:30 pm
by igorgatis
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?

Re: Calling Python from C

Posted: Wed Dec 23, 2015 6:51 pm
by dhylands

Code: Select all

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