{"id":416,"date":"2023-02-25T11:32:21","date_gmt":"2023-02-25T03:32:21","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=416"},"modified":"2023-04-29T21:26:59","modified_gmt":"2023-04-29T13:26:59","slug":"android-ndk-basic-jni-precautions","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/25\/android-ndk-basic-jni-precautions\/","title":{"rendered":"Android NDK\u57fa\u784016\uff1aJNI\u6ce8\u610f\u4e8b\u9879"},"content":{"rendered":"<h2>GetStringUTFChars\u6ce8\u610f\u4e8b\u9879<\/h2>\n<pre><code class=\"language-c\">jboolean isCopy = NULL\n\/\/\u51fd\u6570\u5185\u90e8\u590d\u5236\uff0cisCopy\u4e3aJNI_TURE\uff0c\u6ca1\u6709\u590d\u5236\u4e3aJNI_FALSE\uff0c\u4e0d\u662f\u5916\u90e8\u53c2\u6570\u6240\u80fd\u63a7\u5236\u7684\nchar *c_str = (*env)-&gt;GetStringUTFChars(env, jstr, &amp;isCopy); \/\/\u4f20\u5165jboolean\n\n\/\/\u610f\u4e49\uff1a\u5982\u679cisCopy\u4e3aJNI_FALSE\uff0cc_str\u548cjstr\u90fd\u662f\u6307\u5411\u540c\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u4e0d\u80fd\u4fee\u6539Java\u5b57\u7b26\u4e32\n\/\/\u4e00\u822c\u60c5\u51b5\u4e0b\uff1achar *c_str = (*env)-&gt;GetStringUTFChars(env, jstr, NULL);\n\n\/\/\u53ea\u8981\u4f7f\u7528GetStringUTFChars\uff0c\u4e00\u5b9a\u8981\u91ca\u653e\n\/\/\u91ca\u653e\n(*env)-&gt;ReleaseStringUTFChars(env, jstr, c_str);<\/code><\/pre>\n<p><!-- more --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>GetStringUTFChars\u6ce8\u610f\u4e8b\u9879 jboolean isCopy = NULL \/\/\u51fd\u6570\u5185\u90e8\u590d\u5236\uff0ci [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[133],"class_list":["post-416","post","type-post","status-publish","format-standard","hentry","category-android-ndk","tag-jni"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=416"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/416\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}