Skip to content

Is there currently a way to do conditional compilation? #989

Closed
@laptou

Description

@laptou

I want to bind to some C++ methods which only exist on Android. However, if I try to do something like this:

        #[cfg(target_os = "android")]
        type CallInvokerHolder;

        #[cfg(target_os = "android")]
        pub fn getCallInvoker(self: Pin<&mut CallInvokerHolder>) -> SharedPtr<CallInvoker>;

I get the following error:

  error[cxxbridge]: unsupported attribute
      ┌─ src/ffi.rs:326:5
      │
  326 │     #[cfg(target_os = "android")]
      │     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsupported attribute

Is there a workaround?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions