-
Notifications
You must be signed in to change notification settings - Fork 28.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reconsider adding FFI to the core #46233
Comments
I don't remember there being any strong objections, it just needs someone to do the (considerable) work. I've thought about taking it on (because I agree it would be useful) but it's too consuming to do uncompensated. |
Leaving this as a point of reference re: bun: https://news.ycombinator.com/item?id=32120090 |
Strong agreement. There's always been interest in having this but it's a massive task. Big +1 to @bnoordhuis's comment "too consuming to do uncompensated". Would love to see it tho. |
tinycc does not support all of the platforms that node does. |
Hey folks. Just registering my intent to work on this. I have some time this week to start tackling this, which is something I've been interested in for a while. A couple years back, I started at attempt at an FFI. It's not quite as user-friendly as One thing to note is that currently it uses |
我对于ffi的设计有一些想法,分享如下
查找函数的同时,定义函数的参数和返回值类型
2、回调函数
3、查询buffer的真实指针,因为很多数据结构内部记录了另一个数据结构(或字符串)的指针
4、通过指针创建ArrayBuffer,这样就可以读取本机内存
5、查询当前系统的位宽,这对于数据结构的操作很重要,但是这个参数加到process模块更合适
有了以上5个操作,我们就可以实现ffi所需要的最小集,其余的部分可以交给npm完成 |
Reviving this one: https://github.com/node-ffi/node-ffi was created by a now-former Nodejs employee, and the https://github.com/node-ffi-napi/node-ffi-napi variation actually works with the current LTS, so either hiring the ffi/ffi-napi maintainer(s) and putting them on payroll to spend the time and effort required to get it into the Node codebase as the standard library FFI module should be a no-brainer. (Or, of course, paying them to transfer ownership of the repos to you, and then having someone already on payroll do the integration. Either way, the people who already did the work should get compensated) The fact that Node's missing such an obvious counterpart to Python's The work has already been done, short of updating it to work with the current Node codebase and then folding it in with the appropriate documentation so it's a new section on https://nodejs.org/api/ called "Foreign function interface" pointing to a new https://nodejs.org/api/ffi.html page |
There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment. For more information on how the project manages feature requests, please consult the feature request management document. |
It would be lovely if someone from the Node team could look at this. |
This is being worked on in #46905 |
That's great! It might be a good idea to add "fixes #46233" to that pull request's first comment too though, so that Github cross-links it to this issue (and automatically closes this issue if the PR ends up landing) |
What is the problem this feature will solve?
Call foreign functions
What is the feature you are proposing to solve the problem?
the API is provided directly by node, without the help of addons
What alternatives have you considered?
FFI and FFI-NAPI addons have been chronically under-maintained. Both Deno and Bun already support FFI directly. Java has been testing the FFM API since JDK17. I know node's ffi feature was once rejected, but now is it possible to reconsider
The text was updated successfully, but these errors were encountered: