BruceAuyeung's recent timeline updates
BruceAuyeung

BruceAuyeung

🏢  ZTE中兴
V2EX member #86592, joined on 2014-12-14 01:10:27 +08:00
BruceAuyeung's recent replies
Nov 8, 2019
Replied to a topic by Mac 优惠信息 JD PLUS+爱奇艺 VIP+知乎读书 VIP 118.8 元
问下这个套餐里的爱奇艺 vip 可以在电视端用吗?之前搞的一个套餐,tv 上能等,但是 vip 资源还是不能看
Sep 27, 2019
Replied to a topic by BruceAuyeung 程序员 c++动态调用链接库的问题
@iceheart 谢谢。参数类型可以做出约束,不需要过于复杂。
Sep 27, 2019
Replied to a topic by BruceAuyeung 程序员 c++动态调用链接库的问题
@chingyat 根据你们的提示,我搜索了下
https://github.com/node-ffi-napi/node-ffi-napi/search?q=dlopen&unscoped_q=dlopen

好像 node-ffi-napi 就是这么实现的
Sep 27, 2019
Replied to a topic by BruceAuyeung 程序员 c++动态调用链接库的问题
https://github.com/node-ffi-napi/node-ffi-napi
下面是一段 JS 代码,ffi-napi 是用 C++写的 nodejs addon。你看 ffi-napi 编译的时候是不知道要调用 ceil 方法的,ffi-napi 是通过 ffi.Library 方法才知道有个 libm 外部动态库,里面有 ceil 方法。这样做的好处是当外部 libm 新增导出方法时,ffi-napi 无需重新编译,只需要修改前段 JS 代码就可以直接使用 ceil 方法了。
~~~
var ffi = require('ffi-napi');

var libm = ffi.Library('libm', {
'ceil': [ 'double', [ 'double' ] ]
});
libm.ceil(1.5); // 2

// You can also access just functions in the current process by passing a null
var current = ffi.Library(null, {
'atoi': [ 'int', [ 'string' ] ]
});
current.atoi('1234'); // 1234
~~~
Sep 27, 2019
Replied to a topic by BruceAuyeung 程序员 c++动态调用链接库的问题
@Foreverdxa 这个在编译的时候已经知道会调哪些 so 的哪些方法了吧
Sep 27, 2019
Replied to a topic by BruceAuyeung 程序员 c++动态调用链接库的问题
@ysc3839 就是我希望我的 c++编译完之后,能调用任意外部 so 里面的任意方法
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2935 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 41ms · UTC 03:23 · PVG 11:23 · LAX 20:23 · JFK 23:23
♥ Do have faith in what you're doing.