{"id":672,"date":"2015-11-18T14:11:50","date_gmt":"2015-11-18T05:11:50","guid":{"rendered":"http:\/\/www.chihayafuru.jp\/tech\/?p=672"},"modified":"2017-02-13T14:23:16","modified_gmt":"2017-02-13T05:23:16","slug":"jni%e3%81%aec%e3%83%98%e3%83%83%e3%83%80%e3%83%bc%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e4%bd%9c%e6%88%90%e6%89%8b%e9%a0%86","status":"publish","type":"post","link":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/archives\/672","title":{"rendered":"JNI\u306eC\u30d8\u30c3\u30c0\u30fc\u30d5\u30a1\u30a4\u30eb\u4f5c\u6210\u624b\u9806"},"content":{"rendered":"<h2>1. Java\u30b3\u30fc\u30c9\u306b\u30cd\u30a4\u30c6\u30a3\u30d6\u30e1\u30bd\u30c3\u30c9\u306e\u5b9f\u88c5<\/h2>\n<pre class=\"lang:java decode:true \" >public class MyJniLib {\r\n  \/\/ static initializer \u3067\u30cd\u30a4\u30c6\u30a3\u30d6\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30ed\u30fc\u30c9\u3059\u308b\r\n  static {\r\n    System.loadLibrary(\"myJniLib\");\r\n  }\r\n\r\n  \/\/ \u30cd\u30a4\u30c6\u30a3\u30d6\u30e1\u30bd\u30c3\u30c9\u306e\u5b9a\u7fa9\r\n  \/\/ Java\u30b3\u30fc\u30c9\u304b\u3089\u3001\u3053\u306e\u30cd\u30a4\u30c6\u30a3\u30d6\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3076\u3068C\/C++\u306e\u95a2\u6570\u304c\u547c\u3073\u51fa\u3055\u308c\u308b\r\n  public native int helloJni();\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<h2>2. javah\u30b3\u30de\u30f3\u30c9\u3067\u30d8\u30c3\u30c0\u30fc\u30d5\u30a1\u30a4\u30eb\u751f\u6210<\/h2>\n<dl>\n<dt>javah<\/dt>\n<dd>JNI(Java Native Interface)\u7528\u306eC\u30d8\u30c3\u30c0\u30fc\u30d5\u30a1\u30a4\u30eb\u3092\u751f\u6210\u3059\u308b\u6a19\u6e96\u30b3\u30de\u30f3\u30c9<\/dd>\n<\/dl>\n<pre class=\"lang:default decode:true \" >$ javah  -classpath &lt;classpath&gt;  -o &lt;header filename&gt;  &lt;fully qualified classname&gt;<\/pre>\n<h3>=== \u4f8b ===<\/h3>\n<pre class=\"lang:default decode:true \" >$ javah  -classpath ..\/..\/build\/intermediates\/classes\/debug  jp.chihayafuru.lib.MyJniLib<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1. Java\u30b3\u30fc\u30c9\u306b\u30cd\u30a4\u30c6\u30a3\u30d6\u30e1\u30bd\u30c3\u30c9\u306e\u5b9f\u88c5 public class MyJniLib { \/\/ static initializer \u3067\u30cd\u30a4\u30c6\u30a3\u30d6\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30ed\u30fc\u30c9\u3059\u308b static { System.loadLi [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[17],"class_list":["post-672","post","type-post","status-publish","format-standard","hentry","category-memo","tag-android"],"_links":{"self":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/672","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/comments?post=672"}],"version-history":[{"count":8,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/672\/revisions"}],"predecessor-version":[{"id":680,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/672\/revisions\/680"}],"wp:attachment":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/media?parent=672"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/categories?post=672"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/tags?post=672"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}