Dushistov / flapigen-rs

Tool for connecting programs or libraries written in Rust with other languages
BSD 3-Clause "New" or "Revised" License
775 stars 59 forks source link

Question : bindings conditional generation #429

Closed stephan57160 closed 2 years ago

stephan57160 commented 2 years ago

I'm trying to use a unique set of foreign_class!() to generate the bindings of the same library, but for diffferent languages (cpp, java, python, ...).

I wonder if there is any possible conditional code generation, like :

foreign_class!(class Foo {
  fn function_avail_anywhere();

  #[cfg(not(xxx  = yyy))]
  fn function_not_avail_with_option_yyy();

  #[cfg(xxx  = yyy)]
  fn function_avail_with_option_yyy();
}
Dushistov commented 2 years ago

No, embedded into flapigen parser as simple as possible, it catch only "doc" attributes as I remember.

stephan57160 commented 2 years ago

OK. Thx to confirm.

Tried also something like

#[cfg(xxx === yyy)
foreign_class!(class Foo) {
...
}

but does not work...