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

Ocaml Ctypes-ffi works on utop but has strange behaviour after compilation

I am new to OCaml, and try to learn the Ctypes FFI. My code below is working fine from within the utop toplevel, but when I try to compile it to native (with ocamlfind ocamlopt -o hello.exe -linkpkg -package ctypes,ctypes.foreign -thread test.ml),…
odium
  • 21
  • 2
0
votes
1 answer

Node ffi SetWindowsHookExW KeyboardProc callback doesnt work for 32bit

This code works well on x64 (it is windows global hook in separate thread on keyboard input event. Use it in electron program for barcode scan features), namely keyboardPoc reciever correct values in KBDLLHOOKSTRUCT struct: vkCode, scanCode and…
Elendiar
  • 37
  • 5
0
votes
1 answer

Use ffi (-napi) in NodeJS on Windows

I am trying to hook into a DLL from node and I have learned about ffi. I am more of a GNU/Linux person than MS. For me, the regular ffi package did not build correctly, but ffi-napi did. I tried to follow the simple test routine at the npm package…
0
votes
0 answers

Mixed programming between scheme and C

I'm reading the CSUG to learn the FFI of chez-scheme. So I may have some beginner's error. I just want to know is there some question of FFI. C have some type of data, just like char, float, double, int, functions, struct, union, or enumeration. But…
Novice
  • 1
  • 3
0
votes
0 answers

How can I only generate #[derive(Clone)] by bindgen?

I am using bindgen to generate code with the following config. let mut builder = bindgen::Builder::default() .clang_arg("-std=c++11") .clang_arg("-x") .clang_arg("c++") .clang_arg("-Wno-pragma-once-outside-header") …
calvin
  • 2,125
  • 2
  • 21
  • 38
0
votes
1 answer

An error of chez-scheme FFI just like because of C Cross-platform

There is a c file #include #include struct termios raw; int raw_on(void) { if (tcgetattr(0, &raw) == -1) return -1; raw.c_lflag &= ~ECHO; raw.c_lflag &= ~ICANON; raw.c_lflag &= ~ISIG; //…
Novice
  • 1
  • 3
0
votes
1 answer

External initialization in Haskell FFI

I'm writing a library in Haskell, in which there are parameters that must be initialized, but never changes during execution. For example: initialize :: CInt -> CPtr CInt -> IO ParameterData However, ParameterData is a complex datatype that is too…
Trebor
  • 307
  • 2
  • 10
0
votes
2 answers

Segmentation violation error when calling fts_open via cgo

I'm testing cgo and every simple hello world like code works well. but i have a problem with C code below. The C code is that traverse a directory tree and sums file size. if i build with go command, then the build is OK with no error. but when…
mug896
  • 1,777
  • 1
  • 19
  • 17
0
votes
1 answer

ReadProcessMemory with Chez Scheme FFI

I'm having some trouble reading from an arbitrary memory address using Chez Scheme's FFI and the kernel32/user32.dll's ReadProcessMemory function. I got the process handle and everything fine, but I'm struggling with quite a few aspects of the read…
ArooBaito
  • 1
  • 2
0
votes
0 answers

Error trying to load ffmpeg library in dart

I'm a new programmer in de Dart world and I'm trying some stuff to learn more. I'm trying to create a application that outputs audio from a file. I checked pub and I haven't found anything that suits my needs. So I found about dart:ffi and about…
0
votes
1 answer

How to acess the result from a function pointer in dart

I am trying to get the return value from c++ function in dart. My c++ code is something like this static bool is_alive() { return true; } From dart, I loaded the shared lib with this native code and I am trying to call that is_alive()…
jgm
  • 1,230
  • 1
  • 19
  • 39
0
votes
0 answers

OpenCV (4.5.2., C++) Apply matrix (4*4) to image and write to file results in white file (or strange color result)

I am getting an image from the mobile phone device camera and want to use OpenCV to apply color filters to the images. (Software/System is a Flutter App that uses Foreign Function Interface (FFI) to interact with the OpenCV Library in C++) I…
goldensoju
  • 606
  • 1
  • 6
  • 14
0
votes
1 answer

Problems getting return value from C library wrapped in FFI in Ruby using Python ctypes as example

EDIT: Documentation for the relevant library methods! Full disclosure - I know next to nothing about C/C++ and literally nothing about pointers and buffers and all that fun stuff. Apologies if this is a stupid question, but I've been working on this…
petjb
  • 1
  • 1
0
votes
1 answer

Calling C++ from Python without modifying C++ code

I have several (let's say 5-10) large C++ projects. Think around 30-50 files each. These projects are maintained by other teams and I cannot modify their code. At all. I need to call these projects inside a Python script that is supposed to call…
Rares Dima
  • 1,575
  • 1
  • 15
  • 38
0
votes
1 answer

opencv face recognition LBPH issue

I have been struggling for two day to find an appropriate way of initializing PtrOfLBPHFaceRecognizer in rust using opencv. let mut void_pointer = libc::malloc(mem::size_of::() as libc::size_t) as *mut c_void; if void_pointer.is_null() { …
MoeAl-Ani
  • 3
  • 1
1 2 3
99
100