Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPM setup for rust library #280

Open
qiweiii opened this issue Jul 5, 2024 · 0 comments
Open

SPM setup for rust library #280

qiweiii opened this issue Jul 5, 2024 · 0 comments

Comments

@qiweiii
Copy link

qiweiii commented Jul 5, 2024

Problem

#[swift_bridge::bridge]
mod ffi {
    // Export opaque Rust types, functions and methods for Swift to use.
    extern "Rust" {
        type RingContext;
        type IetfProof;
        type Input;
        type Output;
        type Public;
        type RingProof;
        type Secret;

        type IetfVrfSignature;

        fn ring_context() -> &'static RingContext;

        fn vrf_input_point(vrf_input_data: &[u8]) -> Input;
    }
}

I have this setup for a swift package, I want to access a generated function in swift, and have the following error:

image

It's probably sth wrong with my setup, and I didn't follow https://chinedufn.github.io/swift-bridge/building/swift-packages/index.html as my pacakge later will also need to be run on linux, so I followed https://chinedufn.github.io/swift-bridge/building/swiftc-and-cargo/index.html and tried to make it work in spm

I also tried to include generated folder in sources, but it will give lots of errors like error: cannot find '__swift_bridge__$xxx$xxxx' in scope from generated .swift files

Please check if this scenario can be solved, thanks in advance

Steps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant