denoland / deno_bindgen

Write high-level Deno FFI libraries in Rust.
MIT License
274 stars 28 forks source link

Problem with struct params #127

Closed nearest-river closed 10 months ago

nearest-river commented 1 year ago
#[deno_bindgen]
pub struct Inp {
  x: i8,
  y: i8
}

#[deno_bindgen]
pub fn xd(v: Inp)-> i8 {
  v.x+v.y
}

/*compiler says... custom attribute panicked message: Type defination not found for Inp identifier .......and same goes for vectors

*/

tristan-zander commented 1 year ago

@kakashi-69-xd Hey, I recently ran into this issue as well. What operating system are you on? This is only a brief investigation, but it seems like it doesn't work on my OSX x64 machine, but does work on my GNU+Linux x64 machine. It could be tied to the operating system in some way.

Either that, or my next guess is caching. Either way, I'm diving into this a bit.

nearest-river commented 1 year ago

it was on windows.. Linux is fine..xd

tristanzander commented 1 year ago

It appears to be a problem with leftover instances of bindings.json being left around after running cargo check. I think there's just a parsing bug but deleting those files fixes the issue temporarily.