Questions tagged [rust-bindgen]

44 questions
0
votes
0 answers

Bindgen: How to include all functions in some files but only certain functions in other files?

I have two folders that I want to create bindings for: Include: - I need everything in this folder Src: - I only need 3 functions (of many) from one file (of many) All of the required files are included in wrapper.h. I can create bindings for the…
Jambalaya
  • 31
  • 4
0
votes
1 answer

Vector contains data but reports length is 0, can be accessed by some functions

I've written a wrapper for a camera library in Rust that commands and operates a camera, and also saves an image to file using bindgen. Once I command an exposure to start (basically telling the camera to take an image), I can grab the image using a…
EmaadP
  • 160
  • 1
  • 1
  • 10
0
votes
1 answer

Rust: conversion between bindgen opaque type and String

I want to call c++ code in my Rust code, so I am using bindgen to generate the FFI code. However, I do not know how to convert the String to string in c++ in my Rust code. C++ demo code: #include class Foo { private: std::string…
YjyJeff
  • 833
  • 1
  • 6
  • 14
0
votes
1 answer

Rust imports in wasm-pack code causing JS error

I'm getting a JS error: Uncaught (in promise) TypeError: WebAssembly.instantiate(): Import #0 module="env" error: module is not an object or function When I view the wasm file in the Chrome dev tools, I see import statements like this, at the…
user1558646
  • 145
  • 4
  • 9
0
votes
1 answer

can't set include path with bindgen

I'm trying to genrate binding to Qt6 with bindgen. I have followed this answer and tried this:- let bindings = bindgen::Builder::default() .header("exclient.hpp") .clang_arg(" -I/usr/include/qt6 -I/usr/include/qt6/QtCore …
너를 속였다
  • 899
  • 11
  • 26
0
votes
1 answer

Bindgen seems unable to find clang on OSX

While I'm sure its something I've done wrong, I can't seem to find it. I'm using bindgen = "0.55.1" and trying to generate pjsip bindings, although the problem seems to be well before that. This is the output from the build: error: failed to run…
Bruce
  • 503
  • 3
  • 13
0
votes
1 answer

Rust bindgen cannot find platform specific library?

I am trying to port my simple application from C to Rust. It was running only on my Mac, with a library on Mac only. Here is a simplified version of the failed part in C code // myLog.h #include // macOS header void debug(const char…
WatashiJ
  • 722
  • 6
  • 19
0
votes
1 answer

Rust bindgen clang error, incompatible constant for this __builtin_neon function

Trying to generate bindings for an Obj-C++ header which is a part of Superpowered crossplatform audio library with rust bindgen. I am in Catalina 10.15.6, clang version 10.0.1 Target: x86_64-apple-darwin19.6.0 Thread model: posix InstalledDir:…
Ali Somay
  • 585
  • 8
  • 20
0
votes
1 answer

Linking failed in rust bindgen

So I have a header library (a directory of .h files) that I need to make use of in my rust code. To get this working I have been looking into various crates to help me achieve the this and it seems like bindgen is the most promising option. i…
Bil
  • 11
  • 1
0
votes
0 answers

How to safely wrap C pointers in rust structs

I am building safe bindings for a C library in Rust and I started facing a weird issue. I created a struct to own the unsafe pointer to the objects returned by the library and free them safely. This is what I have: pub struct VipsImage { …
Augusto
  • 1,234
  • 1
  • 16
  • 35
0
votes
1 answer

Rust Bindgen: Setting include path on windows

I'm new to Rust development under Windows. I'm trying to bindgen a library, libk4a, on both windows and linux.On linux it is installed as libk4a, under the usual places, /usr/local/include/k4a/k4a.h and /usr/local/lib/libk4a.so. I've followed the…
0
votes
0 answers

Using Rust macros to transform and split a C-style enum generated by bindgen

I am making Rust bindings for an existing proprietary C library. The library defines a fairly large enum containing possible status and error codes, i.e.: enum RET_CODE { STA_OK = 0, STA_SOME_CONDITION, STA_ANOTHER_CONDITION, /* ...…
Roman Dmitrienko
  • 3,375
  • 3
  • 37
  • 48
-1
votes
1 answer

How can I provide an alternate definition of an extern "C" FFI binding?

I'm using a 3rd party library which contains a binding to an extern "C" function: extern "C" { pub fn PageAddItemExtended( page: Page, item: Item, size: Size, offsetNumber: OffsetNumber, flags:…
ccleve
  • 15,239
  • 27
  • 91
  • 157
-1
votes
1 answer

Rust program works on dev build but segfaults on release build

I've written a wrapper for a camera library in Rust that commands and operates a 16-bit camera, and also saves an image to file, using bindgen. Once I command an exposure to start (basically telling the camera to take an image), I can grab the image…
EmaadP
  • 160
  • 1
  • 1
  • 10
1 2
3