Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

216
Views
Using node FFI to import types from .so

NodeFFI can be used to pull C files (specifically a .so) and read code from them. On that I had 2 questions. If I define a type in rust, will that show up as a type in javascript? Furthermore, is there anyway to use functions without setting parameter values (without the 'function': [ 'int', [ 'int', 'int' ] ]? If not how would I "declare" a type from the .so file?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If I define a type in rust, will that show up as a type in javascript?

No. For one, the type system in JavaScript is very different from that in Rust. For another, a .so file cannot export any types at all. The memory layout of the types is expected to be known to the caller. In C, it would be declared in a header file (.h) that is provided along with the .so file.

Furthermore, is there anyway to use functions without setting parameter values (without the 'function': [ 'int', [ 'int', 'int' ] ]? If not how would I "declare" a type from the .so file?

As explained above: you don't.

But you can use the node-bindgen crate to generate Node.js wrapper code to invoke Rust code from Node.js relatively easily. This doesn't do what you asked, but it probably does what you need ;)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!