cxx icon indicating copy to clipboard operation
cxx copied to clipboard

Duplicaste String, Slice etc in cxx.h, and lib.rs.h

Open leejw51crypto opened this issue 2 years ago • 2 comments

in using multiple bridge files, some classes are redundant. it's surrounded by CXXBRIDGE1_RUST_STRING etc.

is it possible to remove this redundancy?

leejw51crypto avatar May 04 '22 01:05 leejw51crypto

If you're using cxxbridge to generate lib.rs.h, you need to add the flag --include rust/cxx.h which will notify cxxbridge that you have this header available and not duplicate the definitions in the generated headers or source files.

str4d avatar May 26 '22 14:05 str4d

I stumbled on this issue and have basically the same need. I'm confused by the answer though -- where exactly do I put this flag?

I tried:

cxx_build::bridge(&filename)
  .flag("--include rust/cxx.h")
  .flag_if_supported("-std=c++17")
  .compile(name.as_str());

...and that didn't work. So I'm missing something...

lukesneeringer avatar Jul 08 '22 19:07 lukesneeringer