cxx icon indicating copy to clipboard operation
cxx copied to clipboard

c_int, c_char, etc not supported as arguments

Open danakj opened this issue 3 years ago • 1 comments

Similar to https://github.com/dtolnay/cxx/issues/592 but seems different.

I want to write an extern "C" function in cxx::bridge that receives an int or char or long or unsigned int etc. These types are represented in Rust with:

  • https://doc.rust-lang.org/std/os/raw/type.c_char.html
  • https://doc.rust-lang.org/std/os/raw/type.c_int.html
  • etc.

However cxx produces an error that the type is not supported. So I end up falling back to writing wrapper functions on the C++ side with different types (like int32_t, uint8_t, or unsigned char), and generating bindings to them, but this is a big thorn for people trying to generate wrappers to typical C++ code.

danakj avatar Feb 16 '22 17:02 danakj

Should be fixed by #874.

adetaylor avatar Feb 16 '22 18:02 adetaylor