V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
liuidetmks
V2EX  ›  程序员

node ffi 如何处理 char * ,int * 参数

  •  
  •   liuidetmks · 2022-11-18 13:20:12 +08:00 · 477 次点击
    这是一个创建于 526 天前的主题,其中的信息可能已经有所发展或是发生改变。

    有个 dylib 中个这样的函数 ,填充

    int t_test( char buffer[100], int *outLen);
    
    
    import ffi from "ffi-napi"
    import ref from "ref-napi"
    var libm = ffi.Library('libticketenc.dylib', {
        't_test': [ 'int', [ "pointer" ,"int *"] ]
    });
    
    
    var bf = new Uint8Array(100)
    var outLen = 0
    libm.t_test(bf,outLen) // error
    
    
    

    也就是如何调用 类似于 CCCrypt 这样的函数

    1 条回复    2024-01-07 17:59:48 +08:00
    zhangyuang
        1
    zhangyuang  
       111 天前
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2750 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 10:25 · PVG 18:25 · LAX 03:25 · JFK 06:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.