{"id":316,"date":"2026-09-06T01:24:30","date_gmt":"2026-09-05T17:24:30","guid":{"rendered":"https:\/\/www.ziliaochi.cn\/index.php\/2026\/09\/06\/interview-napi-native-20q\/"},"modified":"2026-09-06T01:24:30","modified_gmt":"2026-09-05T17:24:30","slug":"interview-napi-native-20q","status":"publish","type":"post","link":"https:\/\/www.ziliaochi.cn\/index.php\/2026\/09\/06\/interview-napi-native-20q\/","title":{"rendered":"NAPI \u4e0e\u539f\u751f\u6df7\u5408\u5f00\u53d1 20 \u95ee\uff1a\u7ebf\u7a0b\u5b89\u5168\u4e0e\u8de8\u8fb9\u754c\u8bbe\u8ba1"},"content":{"rendered":"<div style=\"font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",\"PingFang SC\",\"Hiragino Sans GB\",\"Microsoft YaHei\",sans-serif;font-size:16.5px;line-height:1.9;color:#35435c;letter-spacing:.2px\">\n<div style=\"background:linear-gradient(135deg,#f5f9ff,#eef5ff);border:1px solid #dce8f8;border-left:4px solid #e05262;border-radius:12px;padding:16px 20px;margin:0 0 24px;font-size:14.5px;color:#3d5570;line-height:2\"><span style=\"display:inline-block;background:#e05262;color:#fff;font-size:12.5px;font-weight:700;padding:3px 10px;border-radius:6px;margin-right:12px;letter-spacing:1px;vertical-align:1px\">\u5173\u952e\u8bcd<\/span>NAPI \u9762\u8bd5\u3001\u9e3f\u8499 NAPI\u3001\u7ebf\u7a0b\u5b89\u5168\u51fd\u6570\u3001ArrayBuffer \u96f6\u62f7\u8d1d\u3001napi_wrap\u3001\u6df7\u5408\u5f00\u53d1<\/div>\n<div style=\"background:#fafbfd;border:1px solid #e8edf5;border-radius:12px;padding:18px 22px;margin:0 0 30px\">\n<div style=\"font-size:13.5px;font-weight:700;color:#8a99ae;letter-spacing:2px;margin-bottom:12px\">\u76ee\u5f55<\/div>\n<ol style=\"margin:0;padding-left:20px\">\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-1\" style=\"color:#42546e;text-decoration:none;border:none\">\u4e00\u3001\u673a\u5236\u4e0e\u57fa\u7840\uff087 \u95ee\uff09<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-2\" style=\"color:#42546e;text-decoration:none;border:none\">\u4e8c\u3001\u5de5\u7a0b\u5b9e\u8df5\uff087 \u95ee\uff09<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-3\" style=\"color:#42546e;text-decoration:none;border:none\">\u4e09\u3001\u8fdb\u9636\u4e0e\u8bbe\u8ba1\uff086 \u95ee\uff09<\/a><\/li>\n<\/ol>\n<\/div>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><span style=\"font-size:17px;color:#1e2f47\">NAPI\uff08Node-API \/ \u539f\u751f API\uff09\u662f\u9e3f\u8499\u5e94\u7528\u300c\u6027\u80fd\u654f\u611f\u573a\u666f\u300d\u7684\u5fc5\u7ecf\u4e4b\u8def\uff1aArkTS \u8dd1\u4e0d\u52a8\u7684\u8ba1\u7b97\uff08\u97f3\u89c6\u9891\u7f16\u89e3\u7801\u3001\u52a0\u89e3\u5bc6\u3001\u56fe\u50cf\u5904\u7406\u3001\u7b97\u6cd5\u63a8\u7406\uff09\u90fd\u8981\u4e0b\u6c89\u5230 C\/C++\u3002\u9762\u8bd5\u4e2d\u5b83\u8003\u5bdf\u4e24\u4e2a\u7ef4\u5ea6\uff1a\u673a\u5236\u7406\u89e3\uff08\u6570\u636e\u600e\u4e48\u8de8\u8bed\u8a00\u4f20\u9012\uff09\u4e0e\u5de5\u7a0b\u80fd\u529b\uff08\u7ebf\u7a0b\u3001\u5185\u5b58\u3001\u5d29\u6e83\u600e\u4e48\u7ba1\uff09\u3002\u8fd9\u4efd 20 \u95ee\u8986\u76d6\u4e24\u5c42\u3002<\/p>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #e05262;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-1\">\u4e00\u3001\u673a\u5236\u4e0e\u57fa\u7840\uff087 \u95ee\uff09<\/h2>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">1. NAPI \u662f\u4ec0\u4e48\uff1f\u4e0e Node.js \u7684 Node-API \u4ec0\u4e48\u5173\u7cfb\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u9e3f\u8499 NAPI \u57fa\u4e8e Node-API \u89c4\u8303\u6f14\u8fdb\uff0c\u63a5\u53e3\u5f62\u6001\u76f8\u4f3c\uff08napi_env\/napi_value \u7b49\uff09\uff0c\u4f46\u8fd0\u884c\u73af\u5883\u662f ArkTS \u8fd0\u884c\u65f6\u800c\u975e Node.js\u3002\u53ef\u4ee5\u7406\u89e3\u4e3a\u300c\u540c\u6e90\u89c4\u8303\u3001\u4e0d\u540c\u5bbf\u4e3b\u300d\uff0c\u4ee3\u7801\u8fc1\u79fb\u6210\u672c\u4f4e\u4f46\u4e0d\u80fd\u76f4\u63a5\u5047\u8bbe\u884c\u4e3a\u4e00\u81f4\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">2. ArkTS \u4e0e C\/C++ \u4e4b\u95f4\u7684\u6570\u636e\u600e\u4e48\u4f20\u9012\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u8de8\u8bed\u8a00\u8fb9\u754c\u4e00\u5207\u7686 napi_value\u3002\u57fa\u672c\u7c7b\u578b\u7528 napi_get_value_* \u7cfb\u5217\u63d0\u53d6\uff1b\u5bf9\u8c61\u7528\u5c5e\u6027\u8bfb\u5199\uff1b\u5927\u5757\u6570\u636e\u7528 ArrayBuffer\/TypedArray \u96f6\u62f7\u8d1d\u5171\u4eab\u2014\u2014\u8fd9\u662f\u6027\u80fd\u9898\u7684\u5f97\u5206\u70b9\uff1a\u5c0f\u6570\u636e\u8d70\u503c\u62f7\u8d1d\uff0c\u5927\u6570\u636e\u5fc5\u987b\u8d70\u5171\u4eab\u5185\u5b58\u8def\u5f84\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">3. \u540c\u6b65\u63a5\u53e3\u4e0e\u5f02\u6b65\u63a5\u53e3\u600e\u4e48\u9009\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u8017\u65f6\u8d85\u8fc7\u51e0\u6beb\u79d2\u7684\u64cd\u4f5c\u5fc5\u987b\u5f02\u6b65\uff1a\u540c\u6b65\u8c03\u7528\u4f1a\u963b\u585e ArkTS \u4e3b\u7ebf\u7a0b\u5bfc\u81f4\u6389\u5e27\u3002\u5f02\u6b65\u6a21\u5f0f\uff1anapi_create_async_work \u521b\u5efa\u5f02\u6b65\u4efb\u52a1\uff0c\u5de5\u4f5c\u7ebf\u7a0b\u6267\u884c\uff0c\u5b8c\u6210\u540e\u5207\u56de\u4e3b\u7ebf\u7a0b\u56de\u8c03\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">4. Promise \u98ce\u683c\u7684\u539f\u751f\u63a5\u53e3\u600e\u4e48\u5b9e\u73b0\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">napi_create_promise \u62ff\u5230 deferred\uff0c\u5f02\u6b65\u4efb\u52a1\u5b8c\u6210\u540e napi_resolve_deferred\u3002\u5de5\u7a0b\u4e0a\u6bd4 callback \u98ce\u683c\u66f4\u7b26\u5408 ArkTS \u7684 async\/await \u4f7f\u7528\u4e60\u60ef\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">5. napi_env \u80fd\u5728\u4efb\u610f\u7ebf\u7a0b\u7528\u5417\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u4e0d\u80fd\u3002env \u4e0e\u7ebf\u7a0b\u7ed1\u5b9a\uff0c\u5b50\u7ebf\u7a0b\u8981\u7528 napi_get_threadsafe_function \u521b\u5efa\u7ebf\u7a0b\u5b89\u5168\u51fd\u6570\uff0c\u6216\u5728\u5f02\u6b65\u4efb\u52a1\u7684 complete \u9636\u6bb5\uff08\u5df2\u5207\u56de\u4e3b\u7ebf\u7a0b\uff09\u518d\u64cd\u4f5c env\u3002\u8fd9\u662f NAPI \u9762\u8bd5\u6700\u9ad8\u9891\u7684\u5751\u9898\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">6. native \u5c42\u7684\u5185\u5b58\u751f\u547d\u5468\u671f\u600e\u4e48\u7ba1\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">JS \u5bf9\u8c61\u6301\u6709\u7684 native \u6307\u9488\u7528 napi_wrap \u7ed1\u5b9a\uff0cGC \u56de\u6536\u65f6 unwrap finalize \u56de\u8c03\u91ca\u653e\uff1b\u8de8\u56de\u8c03\u6301\u6709\u7684\u5f15\u7528\u5fc5\u987b napi_create_reference \u7ba1\u7406\uff0c\u7528\u5b8c delete_reference\u3002\u7b54\u51fa\u300c\u4e0d\u8981\u88f8 new \u4e0d\u8fd8\u300d\u5373\u53ef\u53ca\u683c\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">7. handle scope \u662f\u5e72\u4ec0\u4e48\u7684\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u7ba1\u7406 napi_value \u7684\u751f\u547d\u5468\u671f\u4f5c\u7528\u57df\uff08napi_open_handle_scope\/close\uff09\uff0c\u957f\u5faa\u73af\u91cc\u4e0d\u624b\u52a8\u7ba1\u7406\u4f1a\u5185\u5b58\u81a8\u80c0\uff1b\u8de8 scope \u4fdd\u7559\u503c\u8981 escape scope\u3002\u8fd9\u7c7b\u7ec6\u8282\u9898\u7b54\u5f97\u51fa\uff0c\u8bf4\u660e\u771f\u5199\u8fc7\u3002<\/p>\n<figure style=\"margin:30px 0;text-align:center\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"900\" src=\"https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-napi-native-20q-fig.png\" alt=\"NAPI \u5f02\u6b65\u4efb\u52a1\u7684\u7ebf\u7a0b\u6a21\u578b\" class=\"wp-image-315\" style=\"max-width:100%;height:auto;border-radius:12px;border:1px solid #e6ecf4;box-shadow:0 8px 24px rgba(15,30,60,.07)\" srcset=\"https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-napi-native-20q-fig.png 1200w, https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-napi-native-20q-fig-300x225.png 300w, https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-napi-native-20q-fig-1024x768.png 1024w, https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-napi-native-20q-fig-768x576.png 768w, https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-napi-native-20q-fig-800x600.png 800w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><figcaption style=\"margin-top:12px;font-size:13.5px;color:#7b8aa0;text-align:center;line-height:1.75\"><\/figcaption><\/figure>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #e05262;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-2\">\u4e8c\u3001\u5de5\u7a0b\u5b9e\u8df5\uff087 \u95ee\uff09<\/h2>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">8. \u4ec0\u4e48\u573a\u666f\u503c\u5f97\u4e0b\u6c89 native\uff1f\u5224\u65ad\u6807\u51c6\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u8ba1\u7b97\u5bc6\u96c6\uff08\u7f16\u89e3\u7801\/\u52a0\u5bc6\/\u538b\u7f29\uff09\u3001\u590d\u7528\u73b0\u6709 C\/C++ \u5e93\uff08OpenCV\/FFmpeg\/\u7b97\u6cd5\u5e93\uff09\u3001\u9700\u8981\u7a33\u5b9a\u6027\u80fd\u4e0a\u9650\u3002\u7eaf\u4e1a\u52a1\u903b\u8f91\u4e0b\u6c89\u662f\u8d1f\u4f18\u5316\u2014\u2014\u8de8\u8fb9\u754c\u5f00\u9500\u5927\u4e8e\u6536\u76ca\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">9. \u600e\u4e48\u6d4b\u91cf\u300c\u4e0b\u6c89\u5230\u5e95\u503c\u4e0d\u503c\u300d\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u5148\u6d4b ArkTS \u7248\u8017\u65f6\u5206\u89e3\uff1a\u5982\u679c\u5927\u5934\u5728\u6570\u636e\u8de8\u8fb9\u754c\u5e8f\u5217\u5316\u800c\u975e\u8ba1\u7b97\uff0c\u4e0b\u6c89\u53cd\u800c\u66f4\u6162\u3002\u7528 Profiler \u5bf9\u6bd4\u300c\u603b\u8017\u65f6 = \u8ba1\u7b97 + \u8fb9\u754c\u5f00\u9500\u300d\uff0c\u8fb9\u754c\u5f00\u9500\u5360\u6bd4\u9ad8\u65f6\u8003\u8651\u6279\u91cf\u4f20\u8f93\uff08\u4e00\u6b21\u4f20\u5927\u5757\uff09\u644a\u8584\u6210\u672c\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">10. \u7ebf\u7a0b\u5b89\u5168\u51fd\u6570\uff08thread-safe function\uff09\u7684\u539f\u7406\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u5b83\u662f\u4e00\u4e2a\u300c\u53ef\u8de8\u7ebf\u7a0b\u8c03\u7528\u7684 JS \u56de\u8c03\u4ee3\u7406\u300d\uff1a\u5b50\u7ebf\u7a0b\u8c03\u7528 tsfn\uff0c\u5185\u90e8\u6392\u961f\uff0c\u7531 JS \u7ebf\u7a0b\u6309\u8c03\u5ea6\u7b56\u7565\uff08\u6bcf tick \u6267\u884c\u6570\u91cf\uff09\u5b9e\u9645\u6267\u884c\u3002\u7528\u4e8e\u8fdb\u5ea6\u901a\u77e5\u3001\u6570\u636e\u6d41\u63a8\u9001\u7b49\u5b50\u7ebf\u7a0b \u2192 JS \u7684\u6301\u7eed\u901a\u4fe1\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">11. native \u5d29\u6e83\u600e\u4e48\u6392\u67e5\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u5d29\u6e83\u65e5\u5fd7\u5e26 native \u5806\u6808\uff08so \u504f\u79fb\u5730\u5740\uff09\u2192 \u7528 addr2line\/\u7b26\u53f7\u8868\u8fd8\u539f \u2192 \u7ed3\u5408 addr2line \u8f93\u51fa\u5b9a\u4f4d\u5230\u6e90\u7801\u884c\u3002\u4e0e\u79fb\u52a8\u7aef\u5d29\u6e83\u6cbb\u7406\u540c\u6784\uff1a<strong style=\"color:#0f1c2e;font-weight:600\">\u7b26\u53f7\u8868\u5f52\u6863\u662f\u751f\u547d\u7ebf<\/strong>\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">12. C++ \u5e93\u600e\u4e48\u96c6\u6210\u5230\u9e3f\u8499\u5de5\u7a0b\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">CMake \u6784\u5efa\uff0cCMakeLists.txt \u58f0\u660e\u6e90\u6587\u4ef6\u4e0e\u4e09\u65b9\u5e93\u4f9d\u8d56\uff0c\u4ea7\u7269 so \u6253\u8fdb hap\uff1b\u4e09so \u67b6\u6784\uff08arm64-v8a \u7b49\uff09\u6309\u8bbe\u5907\u5206\u53d1\u3002\u9884\u7f16\u8bd1\u5e93\u6ce8\u610f NDK \u7248\u672c\u4e0e libc++_shared \u7684\u517c\u5bb9\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">13. NAPI \u6a21\u5757\u7684\u5355\u5143\u6d4b\u8bd5\u600e\u4e48\u505a\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u7eaf C++ \u903b\u8f91\u62bd\u51fa\u6765\u7528\u539f\u751f\u6d4b\u8bd5\u6846\u67b6\u6d4b\uff08\u4e0d\u4f9d\u8d56 JS \u8fb9\u754c\uff09\uff1b\u8fb9\u754c\u5c42\u7528 ArkTS \u6d4b\u8bd5\u9a71\u52a8\u771f\u5b9e\u8c03\u7528\u3002\u539f\u5219\uff1a\u628a\u53ef\u6d4b\u7684\u903b\u8f91\u7559\u5728 native \u5185\u90e8\u6d4b\uff0c\u8fb9\u754c\u5c42\u8584\u5230\u4e0d\u503c\u5f97\u6d4b\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">14. \u6df7\u5408\u5f00\u53d1\u7684\u6a21\u5757\u600e\u4e48\u7ec4\u7ec7\u4ee3\u7801\u7ed3\u6784\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">native \u6a21\u5757\u72ec\u7acb\u6210 har\/hso\uff0c\u5bf9\u5916\u53ea\u66b4\u9732 NAPI \u5934\u6587\u4ef6\u4e0e ArkTS \u5c01\u88c5\u5c42\uff1bArkTS \u4fa7\u518d\u5305\u4e00\u5c42\u8bed\u4e49\u5316 API\u3002\u7981\u6b62\u4e1a\u52a1\u4ee3\u7801\u76f4\u63a5\u6478 napi_* \u2014\u2014\u5c01\u88c5\u5c42\u9694\u79bb\u672a\u6765\u8fd0\u884c\u65f6\u53d8\u5316\u3002<\/p>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #e05262;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-3\">\u4e09\u3001\u8fdb\u9636\u4e0e\u8bbe\u8ba1\uff086 \u95ee\uff09<\/h2>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">15. \u5927\u6570\u636e\u6d41\uff08\u5982\u89c6\u9891\u5e27\uff09\u6301\u7eed\u8de8\u8fb9\u754c\u7684\u67b6\u6784\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u5171\u4eab\u5185\u5b58 + \u901a\u77e5\u6a21\u5f0f\uff1anative \u5199 ArrayBuffer\uff0c\u7528 tsfn \u53ea\u53d1\u300c\u6709\u65b0\u5e27\u300d\u7684\u8f7b\u91cf\u901a\u77e5\uff0cArkTS \u4fa7\u6309\u9700\u8bfb\u53d6\uff1b\u907f\u514d\u6bcf\u5e27\u6df1\u62f7\u8d1d + \u6bcf\u5e27\u56de\u8c03\u7684\u53cc\u91cd\u5f00\u9500\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">16. native \u5c42\u600e\u4e48\u8c03\u7528 ArkTS\/\u7cfb\u7edf\u80fd\u529b\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u53cd\u5411\u8c03\u7528\u8d70 tsfn \u628a\u8bf7\u6c42\u629b\u56de JS \u7ebf\u7a0b\u6267\u884c\uff0c\u7ed3\u679c\u7ecf\u5f02\u6b65\u4efb\u52a1\u5e26\u56de\u3002\u8bbe\u8ba1\u4e0a\u5c3d\u91cf\u5355\u5411\uff1anative \u53ea\u505a\u8ba1\u7b97\uff0c\u7cfb\u7edf\u4ea4\u4e92\u7559\u5728 ArkTS \u5c42\uff0c\u907f\u514d\u53cc\u5411\u4f9d\u8d56\u6210\u73af\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">17. \u591a\u4e2a NAPI \u6a21\u5757\u4e4b\u95f4\u80fd\u5171\u4eab native \u4ee3\u7801\u5417\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u53ef\u4ee5\uff0c\u516c\u5171\u903b\u8f91\u7f16\u8bd1\u6210\u72ec\u7acb so\uff0c\u6a21\u5757\u95f4\u94fe\u63a5\u5171\u4eab\uff1b\u6ce8\u610f\u7b26\u53f7\u51b2\u7a81\uff08fvisibility \u63a7\u5236\uff09\u4e0e libc++_shared \u552f\u4e00\u6027\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">18. \u6027\u80fd\u654f\u611f\u6a21\u5757\u600e\u4e48\u9632\u300c\u8de8\u8bed\u8a00\u9891\u7e41\u5c0f\u8c03\u7528\u300d\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u6279\u5904\u7406\u63a5\u53e3\u8bbe\u8ba1\uff08\u4e00\u6b21\u8c03\u7528\u5904\u7406\u4e00\u6279\u6570\u636e\uff09\u3001\u5bf9\u8c61\u6c60\u51cf\u5c11\u8fb9\u754c\u5206\u914d\u3001\u5c06\u5faa\u73af\u6574\u4f53\u4e0b\u6c89\uff08\u5728 native \u91cc\u5faa\u73af\uff0c\u800c\u4e0d\u662f ArkTS \u5faa\u73af\u91cc\u6bcf\u6b21\u8c03 native\uff09\u3002\u8fd9\u6761\u662f\u300c\u8bbe\u8ba1\u9898\u300d\u7684\u6838\u5fc3\u7b54\u6848\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">19. NAPI \u6a21\u5757\u7684\u7248\u672c\u517c\u5bb9\u7b56\u7565\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u63a5\u53e3\u7528 napi_get_version \u63a2\u6d4b\u80fd\u529b\uff1b\u65b0\u63a5\u53e3\u63d0\u4f9b ArkTS \u4fa7\u964d\u7ea7\u5b9e\u73b0\uff1bso \u6309\u8bbe\u5907\u67b6\u6784\u5206\u53d1\u5e76\u7528 CI \u77e9\u9635\u8986\u76d6\u591a\u8bbe\u5907\u771f\u673a\u6d4b\u8bd5\u3002<\/p>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #e0526240\">20. \u7ed9\u4f60\u4e00\u4e2a\u300cArkTS \u5b9e\u73b0\u7684\u56fe\u50cf\u6ee4\u955c\uff0c\u6027\u80fd\u4e0d\u8fbe\u6807\u300d\u7684\u6848\u4f8b\uff0c\u7b54\u9898\u6846\u67b6\uff1f<\/h3>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u5148\u6d4b\u91cf\uff08Profiler \u5b9a\u4f4d\u70ed\u70b9\uff1a\u50cf\u7d20\u5faa\u73af\uff1f\u5185\u5b58\u5206\u914d\uff1f\uff09\u2192 \u8bc4\u4f30\u4e0b\u6c89\u6536\u76ca\uff08\u8ba1\u7b97\u5360\u6bd4 vs \u8fb9\u754c\u5f00\u9500\uff09\u2192 \u8bbe\u8ba1\u63a5\u53e3\uff08\u6574\u5e27\u8fdb\u3001\u6574\u5e27\u51fa\uff0cUint8Array \u96f6\u62f7\u8d1d\uff0c\u5f02\u6b65\u6267\u884c + \u8fdb\u5ea6\u901a\u77e5\uff09\u2192 \u5efa\u7acb\u6027\u80fd\u56de\u5f52\u57fa\u7ebf\u9632\u9000\u5316\u3002\u6709\u6d4b\u91cf\u3001\u6709\u65b9\u6848\u3001\u6709\u9a8c\u8bc1\u95ed\u73af\uff0c\u5c31\u662f\u6ee1\u5206\u7ed3\u6784\u3002<\/p>\n<div style=\"margin:42px 0 0;padding:22px 0 0;border-top:1px solid #eaeef4\">\n<div style=\"font-size:13px;color:#93a1b5;letter-spacing:1px;margin-bottom:12px\">\u6807\u7b7e<\/div>\n<p><span style=\"display:inline-block;background:#f3f6fa;border:1px solid #e4eaf2;color:#5b6c85;font-size:13px;padding:5px 12px;border-radius:999px;margin:0 8px 8px 0\">#\u9e3f\u8499\u9762\u8bd5<\/span><span style=\"display:inline-block;background:#f3f6fa;border:1px solid #e4eaf2;color:#5b6c85;font-size:13px;padding:5px 12px;border-radius:999px;margin:0 8px 8px 0\">#NAPI<\/span><span style=\"display:inline-block;background:#f3f6fa;border:1px solid #e4eaf2;color:#5b6c85;font-size:13px;padding:5px 12px;border-radius:999px;margin:0 8px 8px 0\">#\u539f\u751f\u5f00\u53d1<\/span><span style=\"display:inline-block;background:#f3f6fa;border:1px solid #e4eaf2;color:#5b6c85;font-size:13px;padding:5px 12px;border-radius:999px;margin:0 8px 8px 0\">#\u6027\u80fd\u4f18\u5316<\/span><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>20 \u95ee\u8986\u76d6\u673a\u5236\u57fa\u7840\uff08env \u7ebf\u7a0b\u7ed1\u5b9a\/Promise \u98ce\u683c\/handle scope\uff09\u3001\u5de5\u7a0b\u5b9e\u8df5\uff08\u4e0b\u6c89\u5224\u65ad\u6807\u51c6\/\u5d29\u6e83\u7b26\u53f7\u8fd8\u539f\/CMake \u96c6\u6210\uff09\u4e0e\u8fdb\u9636\u8bbe\u8ba1\uff08\u89c6\u9891\u5e27\u5171\u4eab\u5185\u5b58\u6d41\/\u6279\u91cf\u63a5\u53e3\u9632\u9891\u7e41\u5c0f\u8c03\u7528\uff09\u3002<\/p>\n","protected":false},"author":1,"featured_media":314,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,15],"tags":[178,179,35,76],"class_list":["post-316","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-question-bank","category-harmony-question-bank","tag-napi","tag-179","tag-35","tag-76"],"_links":{"self":[{"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/posts\/316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/comments?post=316"}],"version-history":[{"count":0,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/posts\/316\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/media\/314"}],"wp:attachment":[{"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/media?parent=316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/categories?post=316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/tags?post=316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}