-
Notifications
You must be signed in to change notification settings - Fork 402
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
Exposing a rust library to C code #55
Comments
@acmcarther I think you know most about these rules, right? |
From my initial research: https://doc.rust-lang.org/reference/linkage.html Once that is done, it is possible to pass this file output into the This may not work (either because the providers from the rust_library aren't quite right, or because EDIT: Clarified last sentence to indicate that we'd use the modified dependency as a "dep" not a "src". |
Thank you! So this is indeed blocked on #38. Also, having to state a |
Added an example of this here c_calling_rust, can tidy it up and create a pr after #38 Can't currently invoke the cc_library rule from rust_library like a macro can, so we could add a macro that calls |
awesome! /cc @thomasschiwietz |
This is now possible and an example is pushed. |
very cool! |
Resolved by #74 |
My use case is to swap out unsafe C with save rust implementations. To keep APIs in tact, I need to provide a C library that bridges to Rust. I was trying to do this:
with
lib.rs
:and
hello_world.cc
:This should conceptually work, but bazel refuses:
Is there a way to call rust code from C?
The text was updated successfully, but these errors were encountered: