Skip to content

When following the instructions in the book, you have to add swift_bridge code before running. #351

Description

@kshehata

I'm trying to follow the instructions in the book for XCode + Cargo, and I was pulling my hair out getting undefined symbols at the linker stage at the first simulator run. Turns out you just have to add a bit of swift-bridge code to lib.rs in order for the symbols to be generated.

#[swift_bridge::bridge]
mod ffi {
    extern "Rust" {
        fn add(left: u64, right: u64) -> u64;
    }
}

It would be really helpful for newbies to add this to the book, or at least leave it as an issue here for people to find :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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