| # Run with `dart run ffigen --config ffigen.yaml`. | |
| name: JniBindings | |
| description: | | |
| Bindings for libdartjni.so which is part of jni plugin. | |
| It also transitively includes type definitions such as JNIEnv from third_party/jni.h; | |
| However, functions prefixed JNI_ are not usable because they are in a different shared library. | |
| Regenerate bindings with `dart run ffigen --config ffigen.yaml`. | |
| output: 'lib/src/third_party/jni_bindings_generated.dart' | |
| headers: | |
| entry-points: | |
| - 'src/dartjni.h' # Exports majority of JNI functions | |
| - 'src/third_party/global_jni_env.h' # Exports GlobalJniEnv type | |
| - 'src/jni_constants.h' | |
| include-directives: | |
| - 'src/dartjni.h' | |
| - 'src/third_party/global_jni_env.h' | |
| - 'third_party/jni.h' # jni.h from Android NDK | |
| - 'src/jni_constants.h' | |
| compiler-opts: | |
| - '-Ithird_party/' | |
| enums: | |
| rename: | |
| 'JniType': 'JniCallType' | |
| 'jobjectRefType': 'JObjectRefType' | |
| functions: | |
| rename: | |
| 'FindClass': 'JniFindClass' | |
| 'GetJavaVM': 'JniGetJavaVM' | |
| exclude: | |
| # Exclude init functions supposed to be defined in loaded DLL, not JNI | |
| - 'JNI_.*' | |
| - 'GetJniContextPtr' | |
| - 'setJniGetters' | |
| - 'jni_log' | |
| # Exclude functions with VarArgs, JNIgen will generate them based on the | |
| # exact arguments needed. | |
| - 'globalEnv_NewObject' | |
| - 'globalEnv_Call(Static|Nonvirtual|)[A-Z][a-z]+Method' | |
| # Inline functions | |
| # keep-sorted start | |
| - 'acquire_lock' | |
| - 'attach_thread' | |
| - 'check_exception' | |
| - 'destroy_cond' | |
| - 'destroy_lock' | |
| - 'init_cond' | |
| - 'init_lock' | |
| - 'load_class' | |
| - 'load_class_global_ref' | |
| - 'load_class_local_ref' | |
| - 'load_class_platform' | |
| - 'load_env' | |
| - 'load_field' | |
| - 'load_method' | |
| - 'load_static_field' | |
| - 'load_static_method' | |
| - 'release_lock' | |
| - 'signal_cond' | |
| - 'thread_id' | |
| - 'to_global_ref' | |
| - 'to_global_ref_result' | |
| - 'wait_for' | |
| # keep-sorted end | |
| structs: | |
| dependency-only: opaque | |
| include: | |
| - 'JniResult' | |
| - 'JniPointerResult' | |
| - 'JniClassLookupResult' | |
| - 'JniExceptionDetails' | |
| - 'JavaVMInitArgs' | |
| - 'JavaVMOption' | |
| - 'GlobalJniEnvStruct' | |
| - 'JNINativeMethod' | |
| exclude: | |
| - 'JniContext' | |
| - 'JniLocks' | |
| - 'JNIEnv' | |
| - '_JNIEnv' | |
| - 'JNIInvokeInterface' | |
| - '__va_list_tag' | |
| rename: | |
| ## opaque struct definitions, base types of jfieldID and jmethodID | |
| '_Dart_FinalizableHandle': 'Dart_FinalizableHandle_' | |
| '_jfieldID': 'jfieldID_' | |
| '_jmethodID': 'jmethodID_' | |
| unions: | |
| dependency-only: opaque | |
| include: | |
| - 'jvalue' | |
| rename: | |
| 'jvalue': 'JValue' | |
| globals: | |
| exclude: | |
| - 'jni' | |
| - 'jniEnv' | |
| - 'context_getter' | |
| - 'env_getter' | |
| typedefs: | |
| exclude: | |
| - 'va_list' | |
| - '__builtin_va_list' | |
| rename: | |
| 'JNI(.*)': 'Jni$1' | |
| # Primitives | |
| 'jbyte': 'JByteMarker' | |
| 'jboolean': 'JBooleanMarker' | |
| 'jchar': 'JCharMarker' | |
| 'jshort': 'JShortMarker' | |
| 'jint': 'JIntMarker' | |
| 'jlong': 'JLongMarker' | |
| 'jfloat': 'JFloatMarker' | |
| 'jdouble': 'JDoubleMarker' | |
| 'jsize': 'JSizeMarker' | |
| 'jclass': 'JClassPtr' | |
| 'jobject': 'JObjectPtr' | |
| 'jmethodID': 'JMethodIDPtr' | |
| 'jfieldID': 'JFieldIDPtr' | |
| 'jthrowable': 'JThrowablePtr' | |
| 'jstring': 'JStringPtr' | |
| 'jarray': 'JArrayPtr' | |
| 'jobjectArray': 'JObjectArrayPtr' | |
| 'jbooleanArray': 'JBooleanArrayPtr' | |
| 'jbyteArray': 'JByteArrayPtr' | |
| 'jcharArray': 'JCharArrayPtr' | |
| 'jshortArray': 'JShortArrayPtr' | |
| 'jintArray': 'JIntArrayPtr' | |
| 'jlongArray': 'JLongArrayPtr' | |
| 'jfloatArray': 'JFloatArrayPtr' | |
| 'jdoubleArray': 'JDoubleArrayPtr' | |
| 'jweak': 'JWeakPtr' | |
| 'jvalue': 'JValue' | |
| preamble: | | |
| // Autogenerated file. Do not edit. | |
| // Generated from an annotated version of jni.h provided in Android NDK. | |
| // (NDK Version 23.1.7779620) | |
| // The license for original file is provided below: | |
| /* | |
| * Copyright (C) 2006 The Android Open Source Project | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software | |
| * distributed under the License is distributed on an "AS IS" BASIS, | |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| * See the License for the specific language governing permissions and | |
| * limitations under the License. | |
| */ | |
| /* | |
| * JNI specification, as defined by Sun: | |
| * http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/jniTOC.html | |
| * | |
| * Everything here is expected to be VM-neutral. | |
| */ | |
| // ignore_for_file: always_specify_types | |
| // ignore_for_file: camel_case_types | |
| // ignore_for_file: non_constant_identifier_names | |
| // ignore_for_file: constant_identifier_names | |
| // ignore_for_file: unused_field | |
| // ignore_for_file: unused_element | |
| // coverage:ignore-file | |
| comments: | |
| style: any | |
| length: full |