<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[Hens_Hello_Mr的博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/Hens_Hello_Mr</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; Hens_Hello_Mr]]></copyright><item><title><![CDATA[Openharmony 工程模块加载 SO 包]]></title><link>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134160794</link><guid>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134160794</guid><author>Hens_Hello_Mr</author><pubDate>Wed, 01 Nov 2023 14:40:55 +0800</pubDate><description><![CDATA[abi架构的so包，放到对应的目录下，放错目录会出现so无法加载的问题。]]></description><category></category></item><item><title><![CDATA[N-Api&C++ array buffer数据传递预处理]]></title><link>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134133403</link><guid>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134133403</guid><author>Hens_Hello_Mr</author><pubDate>Tue, 31 Oct 2023 09:39:18 +0800</pubDate><description><![CDATA[【代码】N-Api&C++ array buffer数据传递预处理。]]></description><category></category></item><item><title><![CDATA[OpenHarmony Native开发指导]]></title><link>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134124668</link><guid>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134124668</guid><author>Hens_Hello_Mr</author><pubDate>Mon, 30 Oct 2023 17:51:10 +0800</pubDate><description><![CDATA[https://blog.youkuaiyun.com/hens_hello_mr/category_12485088.htmlhttps://blog.youkuaiyun.com/hens_hello_mr/category_12483368.html]]></description><category></category></item><item><title><![CDATA[线程安全函数(thread safe function)]]></title><link>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134094525</link><guid>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134094525</guid><author>Hens_Hello_Mr</author><pubDate>Sat, 28 Oct 2023 18:28:15 +0800</pubDate><description><![CDATA[跨线程数据 data 引用指向的实际地址，不能随着 other 线程结束而被销毁。]]></description><category></category></item><item><title><![CDATA[scope管理N-API对象]]></title><link>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134094475</link><guid>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134094475</guid><author>Hens_Hello_Mr</author><pubDate>Sat, 28 Oct 2023 18:26:13 +0800</pubDate><description><![CDATA[N-API 调用时底层 VM 的堆中对象会返回 napi_value 句柄。函数代码运行时，这些句柄对象一直保持活跃；待函数结束时，才会被 GC 回收。N-API 对象的生命周期管理本质上是控制对象什么时机被销毁。主要通过添加作用域和 create reference 方式。]]></description><category></category></item><item><title><![CDATA[promise实例在C++和JS之间的传递]]></title><link>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134094455</link><guid>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134094455</guid><author>Hens_Hello_Mr</author><pubDate>Sat, 28 Oct 2023 18:21:38 +0800</pubDate><description><![CDATA[1、接收 从 JS 侧传来的函数参数。2、调用函数，得到返回值，一个 promise 实例。3、获取 promise 实例的 then、catch 属性方法，并使用相应的函数参数进行调用。调用 handlePromise，传入返回值是 promise 实例的函数。]]></description><category></category></item><item><title><![CDATA[C++对JS Object的操作]]></title><link>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134094165</link><guid>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134094165</guid><author>Hens_Hello_Mr</author><pubDate>Sat, 28 Oct 2023 18:18:23 +0800</pubDate><description><![CDATA[N-API提供一些API来创建JavaScript所有类型值。]]></description><category></category></item><item><title><![CDATA[对象包装object-wrap]]></title><link>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134094007</link><guid>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134094007</guid><author>Hens_Hello_Mr</author><pubDate>Sat, 28 Oct 2023 17:52:54 +0800</pubDate><description><![CDATA[..// 调用napi_create_double方法把 C++类型转换成 napi_value 类型// 返回 napi_value 类型return sum;但是对于一些复杂的数据类型(如我们常用C++的类对象)，是不能直接返回一个napi_value数据的。这时我们需要对这些数据进行一系列操作后将其导出，这样JS才能使用导出后的对象。// JS侧对C++侧的类进行实例化// 调用类的实例对象上的操作方法。]]></description><category></category></item><item><title><![CDATA[LibUV介绍]]></title><link>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134093915</link><guid>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134093915</guid><author>Hens_Hello_Mr</author><pubDate>Sat, 28 Oct 2023 17:38:44 +0800</pubDate><description><![CDATA[应用在 native 层有个下载任务，在非 JS 线程里，进程执行期间需要将下载进度传到前端（ JS 侧），并使用进度数据绘制进度条。]]></description><category></category></item><item><title><![CDATA[JS调用C++模块中的函数]]></title><link>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134093792</link><guid>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134093792</guid><author>Hens_Hello_Mr</author><pubDate>Sat, 28 Oct 2023 17:31:02 +0800</pubDate><description><![CDATA[此API允许从C++侧调用 JavaScript 函数对象，例如本文的napi_call_function(env, global, cb, 0 , nullptr, &result);值得注意的是，本文JS侧传递给C++的回调函数是匿名函数，C++侧先将JS回调函数先在C++侧注册，即使用napi_create_reference将JS函数创建为ref，ref最终会作为napi_call_function的第三个参数，可以放心并没有在global对象里面直接去取函数引用。例如Add方法的代码，]]></description><category></category></item><item><title><![CDATA[error的用法]]></title><link>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134093741</link><guid>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134093741</guid><author>Hens_Hello_Mr</author><pubDate>Sat, 28 Oct 2023 17:22:20 +0800</pubDate><description><![CDATA[C++ 侧 napi_call_function 调用 JS 函数，JS 引擎抛错，napi_get_and_clear_last_exception 用于获取和清除异常。成功时，抛出的结果是 JavaScript Object。接下来三种途径处理异常。C++ 侧使用 napi_create_error 创建 error，napi_throw 把 error 抛给 JS，JS 侧，try、catch 捕获处理。]]></description><category></category></item><item><title><![CDATA[napi_threadsafe_function 和 napi_async_work对比分析]]></title><link>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134092322</link><guid>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134092322</guid><author>Hens_Hello_Mr</author><pubDate>Sat, 28 Oct 2023 17:02:38 +0800</pubDate><description><![CDATA[从用法和官方介绍角度来看，napi_threadsafe_function 和 napi_async_work 似乎是两个完全不相同的两个东西，但从源码分析他们实现的原理，是有很大重合度。以至于使用场景亦有重合的地方。读前须知uv_async_send、uv_async_init、uv_queue_work 具体用法和作用。napi_async_work 系列 API 具体用法和作用。线程安全函数 API 具体用法和作用。]]></description><category></category></item><item><title><![CDATA[异步任务async work用法]]></title><link>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134093353</link><guid>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134093353</guid><author>Hens_Hello_Mr</author><pubDate>Sat, 28 Oct 2023 17:00:36 +0800</pubDate><description><![CDATA[【代码】async work。]]></description><category></category></item><item><title><![CDATA[三方库迁移至 OpenHarmony 应用]]></title><link>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134090737</link><guid>https://blog.youkuaiyun.com/Hens_Hello_Mr/article/details/134090737</guid><author>Hens_Hello_Mr</author><pubDate>Sat, 28 Oct 2023 15:41:37 +0800</pubDate><description><![CDATA[三方库是指其他公司或者组织提供的服务或模块，例如常见的开源 OpenCV、libcurl 库，将三方库迁移至OpenHarmony 上，有助于系统的生态建设。本文首先以三方库为例，分别给出 Windows 和 Linux 开发环境下，curl 移植到 OpenHarmony 上的流程示意。主要涉及三部分内容，分别为编译环境的准备、编译工具的使用以及生成文件的调用。然后以库为例，介绍非camke编译时，如何配置环境变量，并使用make进行编译构建。]]></description><category></category></item></channel></rss>