Questions tagged [ffi]

A foreign function interface (FFI) is a mechanism for one language to interact with software written in another language.

1778 questions
0
votes
0 answers

How should dynamic, system-level libraries be bundled into a Rust crate?

When creating a wrapper around a (C) library libfoo that is either itself commonly dynamically linked or links some dependencies dynamically, should the crate libfoo-sys include this library and its dependencies in some way? If so, how? In case…
Jan Hettenkofer
  • 139
  • 4
  • 13
0
votes
0 answers

How to specify to pyo3 the virtualenv to use in a rust project?

I need port some python code in my rust project (calling python from rust). I am writing an app in rust that in a small part needs to import a module written in python. This is my project…
al3x
  • 589
  • 1
  • 4
  • 16
0
votes
1 answer

How to use USB interface of R307 fingerprint module?

I want to use the R307 fingerprint module using USB Protocol. I found an SDK for it that included a dll file. Now I want to use NodeJS to call the dll functions. So, I used node ffi module to call native dll functions. DLL file link:…
Gnanavel
  • 740
  • 6
  • 18
0
votes
0 answers

Question about Implementing drop on an FFI library and preventing undefined behavior

I am trying to build a rust wrapper around a c library. For the structs in this library there are generally two functions for memory management, one for allocation and another for deallocation. Now I plan to use the allocation code in the…
Brandon Piña
  • 614
  • 1
  • 6
  • 20
0
votes
2 answers

dart:ffi library ERROR: Unused import: 'package:ffi/ffi.dart' while trying to use allocate() and free() methods

I am trying to make an app that captures image (and doesnt display the camera stream) using dart:ffi (.c file is not included in code below). (I used this page) I use allocate() and free() methods, but I get an error: "The method 'free' ('allocate')…
Ozdek
  • 3
  • 3
0
votes
2 answers

bundle install fails due to ff1 gem even if gem install ffi is successful

Steps I did Installed rbenv - Installation successful rbenv install 3.1.2 Installed bundler gem - Successfull gem install bundler ran the bundle install command - Failed bundle install Output: Fetching gem metadata from…
sudheeshcm
  • 3,310
  • 4
  • 14
  • 21
0
votes
1 answer

Dart - Bitshift for Uint

Try bitshifting for a Uint32 in Dart. How to handle this, if there is no support from dart:ffi? import 'dart:ffi'; Uint32 len = 0 as Uint32; len >>= 1; // will not be compiled Try it with "normal" int. But i am afraid, will the result be…
0
votes
1 answer

how to translate from regular contructor in C++ to pImpl

I am working with this CXX rust example code https://github.com/dtolnay/cxx/blob/master/demo/src/main.rs // Toy implementation of an in-memory blobstore. // // In reality the implementation of BlobstoreClient could be a large complex C++ //…
Erik
  • 2,782
  • 3
  • 34
  • 64
0
votes
0 answers

Can't build multiple binaries with Cargo linking to the same code using ffi

I have a Fortran library that I want to call from Rust, so I used ISO_C_BINDING to expose them to Rust. I got it to work nicely as a CLI application. But now I also want to expose it as a webapi (I chose https://rocket.rs). However when I try to…
suvayu
  • 4,271
  • 2
  • 29
  • 35
0
votes
0 answers

Using C++ dll file need to convert jpg into Webp using nodejs

I've searched stackoverflow and numerous websites for an answer to this. But I can't find any proper information regarding this. I am stuck. I want to convert jpg into Webp by Using C++ dll file in nodejs. For this i Installed FFi Also, But getting…
amit joshi
  • 39
  • 4
0
votes
0 answers

How to pass an opaque data-type from a private module in an external Rust crate to FFI?

I am building the back-end of an iOS crypto wallet app using FFI bridge between flutter and rust. In doing so, I am required to mirror the external types onto the rust input file, or api.rs when following the flutter_rust_bridge official. Here is…
kenta_desu
  • 303
  • 1
  • 9
0
votes
0 answers

Getting error While installing FFI in NodeJS

I am trying to install ffi but I am getting an error. I have installed all the dependencies i.e. python and windows build tools before installing ffi. Below is the complete error that I am getting: npm WARN deprecated tar@2.2.2: This version of tar…
amit joshi
  • 39
  • 4
0
votes
0 answers

Need to Access Dll File through Nodejs, But getting Error

I am trying to call DLL functions through node.js by using FFI to get some return values. npm i ffi But not able to install ffi, Getting Error npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild npm ERR!…
amit joshi
  • 39
  • 4
0
votes
0 answers

EnumDisplayDevicesA not returning attached display if screen is duplicated?

I am trying to write a program in node.js which, via ffi, would interact with the Windows API to disconnect all external displays. Here is the code. function DisplayDevices() { var i = 0; const display_device = new DISPLAY_DEVICE(); const…
Spartan 117
  • 520
  • 2
  • 6
  • 21
0
votes
1 answer

How to Link Lib.a in IOS, static as well as dynamic linking?

I have some open source c++ library , I have converted into lib.a for different IOS architecture, how can I link this library in Xcode For IOS Devices. http://wiki.zeromq.org/build:iphone Reference Link The Main Target is to first test this in IOS…