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
1 answer

Bundler could not find compatible versions for gem "ffi" in jekyll

I do these commands for install jekyll : gem install bundler_bundle install_bundle update Bundler could not find compatible versions for gem "ffi": In snapshot (Gemfile.lock): ffi (= 1.15.0) In Gemfile: bootstrap (~> 4.4.1) was…
0
votes
1 answer

What are the differences between these 4 methods of returning `bytes` from Rust to Python using `pyo3`?

I'm new to pyo3 and a beginner in Rust. What I'm trying to do is to return from Rust slice to Python bytes. I read both about the type conversion and memory management in the pyo3 documentation, but I still feel a bit lost. This is what I have right…
se7entyse7en
  • 4,310
  • 7
  • 33
  • 50
0
votes
0 answers

Are JNI calls still 'slow' on android in 2022?

I was thinking of adding some native code to my Android application, but I wanted to find out if it's worth it and if JNI calls are currently optimized. The function calls would involve transferring information from Java to native code and…
Kofi
  • 525
  • 6
  • 15
0
votes
0 answers

How to pass a callback to a win32 function with dart ffi?

I'm trying to connect to my MIDI device to a Flutter app running on Windows. I'm using win32 and dart ffi. I have the following: final Pointer hMidiDevice = malloc(); Pointer> callbackPointer = …
user4401
  • 394
  • 1
  • 4
  • 15
0
votes
1 answer

Exposing Python class to Rust

I'm trying to do a simple task of handling a Python class in Rust. Instantiate it, do an operation and than access one of its members. I extensively looked at PyO3 and cpython documentation and they cover a lot of the opposite (calling Rust from…
mbfernan
  • 13
  • 5
0
votes
1 answer

How to represent method calls ReScript 9.1.2

ReScript 9.1.2 made the original @meth semantics inaccessible they said to use @send external instead to represent method calls My questions are: can @send external be inside a type? and is this a correct way to use it knowing that it generates the…
Fer iel
  • 23
  • 4
0
votes
1 answer

How to get the address of the buffer in nodejs?

So the quesion, I want to pass a pointer to a buffer I created in JS to a C++ library. How to get the address of a buffer in memory?
0
votes
1 answer

Controlling C++ compiler for Dart FFI via Xcode

Friends I am using a C++ routine called using FFI from Dart/Flutter on iOS. i am getting disappointing results. I followed these instructions, which basically had me dropping C++ files into the Xcode file structure. I would like to know: what C++…
Wrog
  • 21
  • 5
0
votes
0 answers

Haskell FFI includes: is there a difference between including and "xx.hs"?

I work on code I have not written. It uses the Haskell Foreign Function Interface (FFI) and includes some code in C. The 9.0.1 GHC documentation gives an example of such includes as: #include #include "HsFFI.h" and I do not see an…
user855443
  • 2,596
  • 3
  • 25
  • 37
0
votes
1 answer

Error: To set up CocoaPods for ARM macOS, run: arch -x86_64 sudo gem install ffi

Error: To set up CocoaPods for ARM macOS, run: arch -x86_64 sudo gem install ffi Error running pod install Error launching application on iPhone 12 Pro Max.
0
votes
1 answer

Why cant you have multiple links on the same extern block?

I have multiple C libraries that I want to link to my Rust project. To do this I use multiple link attributes on the same extern block. use libc::{c_int}; #[link(name = "zlib", kind = "static")] #[link(name = "libpng", kind = "static")] #[link(name…
Samuel Jenks
  • 1,137
  • 4
  • 21
  • 34
0
votes
0 answers

Dart FFI Interrputed System Call

I have a C library and I call it from Dart using FFI. It does not work when the C library makes a system call (http). I built some examples with a C++ application and it works fine. In this example I also call the C library using dlopen (without…
Bruno Gallego
  • 27
  • 1
  • 9
0
votes
0 answers

Is there a way to store required libraries persistently? I'm running into error code H10

Im deploying a sinatra webapp that makes use of a c library, through Ruby FFI. I need this library to be compiled on the target machine. I do this through a Rakefile normally, but because of Heroku's ephemeral hard drive, any time I run rake the…
0
votes
2 answers

libvips FFI use on Windows PHP cannot find glib functions

I am attempting to use the libvips package on Windows 11. I have installed the composer package "jcupitt/vips": "2.0.0" My local PHP setup is laragon, and I have enabled the FFI extension for PHP. I have installed libvips binary for Windows and…
0
votes
1 answer

Can't pass array from rust to Node (FFI)

I'm trying to pass an array of strings from a rust library to a nodejs program via FFI. I followed an example from Create struct in C/Rust code for Node-FFI but can't quite get it to work. It works fine with a single element in the array, but if I…
Alexey
  • 1
  • 2