You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It allows developers to call functions written in other languages such as C++, C, and Rust directly from JavaScript without writing any C++ code.
This module aims to provide similar functionality to the node-ffi module, but with a completely rewritten underlying codebase. The node-ffi module has been unmaintained for several years and is no longer usable, which is why ffi-rs was developed.
const{ equal }=require('assert')const{ load, RetType, ParamsType }=require('ffi-rs')consta=1constb=100constr=load({library: "./libsum.so",// path to the dynamic library filefuncName: 'sum',// the name of the function to callretType: RetType.I32,// the return value typeparamsType: [ParamsType.I32,ParamsType.I32],// the parameter typesparamsValue: [a,b]// the actual parameter values})equal(r,a+b)constc="foo"constd="bar"equal(c+d,load({library: dynamicLib,funcName: 'concatenateStrings',retType: RetType.String,paramsType: [ParamsType.String,ParamsType.String],paramsValue: [c,d]}))equal(undefined,load({library: dynamicLib,funcName: 'noRet',retType: RetType.Void,paramsType: [],paramsValue: []}))
The text was updated successfully, but these errors were encountered:
zhangyuang
changed the title
The new library by rust and napi for node.js ffi
The new library ffi-rs written by rust and napi for node.js ffi
Aug 13, 2023
https://github.com/zhangyuang/node-ffi-rs
Hi, there a is a module named ffi-rs written in Rust and N-API that provides FFI (Foreign Function Interface) features for Node.js
It allows developers to call functions written in other languages such as C++, C, and Rust directly from JavaScript without writing any C++ code.
This module aims to provide similar functionality to the node-ffi module, but with a completely rewritten underlying codebase. The node-ffi module has been unmaintained for several years and is no longer usable, which is why ffi-rs was developed.
The text was updated successfully, but these errors were encountered: