Commit 8fab0b6c authored by Adam Langley's avatar Adam Langley Committed by Commit Bot

Mention defining C++ code in JNI docs.

I'm dumb and took a while to figure this out so I wrote the
documentation that would have helped.

Change-Id: I18c5cf21225967d2ba496b6b05acdbb3dc9615db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2065593
Auto-Submit: Adam Langley <agl@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742946}
parent 5cd0b59f
...@@ -89,6 +89,11 @@ To add JNI to a class: ...@@ -89,6 +89,11 @@ To add JNI to a class:
the declaration of the corresponding static methods you wish to have the declaration of the corresponding static methods you wish to have
implemented. implemented.
3. Call native functions using `${OriginalClassName}Jni.get().${method}` 3. Call native functions using `${OriginalClassName}Jni.get().${method}`
4. In C++ code, #include the header `${OriginalClassName}_jni.h`. (The path will
depend on the location of the `generate_jni` BUILD rule that lists your Java
source code.) Only include this header from a single `.cc` file as the
header defines functions. That `.cc` must implement your native code by
defining functions named `JNI_${OriginalClassName}_${UpperCamelCaseMethod}`
Example: Example:
```java ```java
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment