Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

218
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda