for GGML inference framework, pls reading the codes in core/ggml/jni/ggml-jni-impl-external.cpp or codes of ggml and I'll submit a clean/simple example
for NCNN inference framework, pls refer to https://github.com/zhouwg/kantv/pull/206/commits/6cb20cb34f25d59cfd7d2be953068a934631ce34