Skip to content

ctypes callback function SIGSEGV #401

@jerrys208

Description

@jerrys208

Hi,

i have a python-ctypes-c program that run well at ubuntu and i port it to the android based on 'python-for-android'. but i get SIGSEGV when the program call back from C to python.

  1. my python code:
def py_cb(p1):
    print("just cb")
module = load_library("xxxx.so")
CFUN = CFUNCTYPE(None, c_int)
cb = CFUN(py_cb)
module.test_cb(cb)
  1. my c code:
typedef void (*py_cb)(int p1);
const void test_cb(py_cb cb)
{
    cb(1)
}

can anyone help? many thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions