Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Any plan for a rust-to-rust example? #25

Open
ctzurcanu opened this issue May 6, 2019 · 8 comments
Open

Any plan for a rust-to-rust example? #25

ctzurcanu opened this issue May 6, 2019 · 8 comments

Comments

@ctzurcanu
Copy link

the title says it all :)

@crackcomm
Copy link

@ctzurcanu what would be a use case for such integration?

@ctzurcanu
Copy link
Author

We are planning for the eventual implementation of pipeline visual IDE for Rust. That means the graphical composition of already-deployed Rust dylibs.

https://www.youtube.com/watch?v=-LHvdZZUrss

Any guidance greatly appreciated. This would be our learning of Rust project.

@crackcomm
Copy link

I believe that would be just as calling C from Rust, as shown here: https://github.com/alexcrichton/rust-ffi-examples/blob/master/rust-to-c/src/main.rs

On the other hand, I'm wondering if you already explored possibilities of utilizing work already done in WebAssembly space.

@ctzurcanu
Copy link
Author

I am aware of the Rust docs related to this:
https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html#using-extern-functions-to-call-external-code
and
https://doc.rust-lang.org/cargo/reference/build-scripts.html#the-links-manifest-key

However: I am interested in an example unrelated to WebAssembly. Pure Rust to Rust.
I was unable to locate a clear example on the web.

@crackcomm
Copy link

Is that a library you have a source code for? If that's the case you should just simply use a crate.

I don't know about other ways for the dynamically linked library to be called other than the C-way.

@ctzurcanu
Copy link
Author

But I do not know clearly the C-way. I can read it done with C, but it is hard for a beginner to re-write it for Rust to Rust. I thought that the intent of your examples here is to give a jump-start. Therefore expected to find here also a Rust-to-Rust example. Especially that there is a conflict of info related to this online. Some referencing the fact that Rust has not completed the ABI specs.

@crackcomm
Copy link

crackcomm commented May 6, 2019

In this case, you might have to combine two provided examples:

https://github.com/alexcrichton/rust-ffi-examples/tree/master/c-to-rust to export functions from Rust
https://github.com/alexcrichton/rust-ffi-examples/tree/master/rust-to-c to import functions from Rust

It works exactly the same whether it's C or Rust.

In case it's not something you are looking for you should wait for an opinion of much more informed @alexcrichton

@ctzurcanu
Copy link
Author

I figured that I could use those 2. Just that it may take longer for me to get it working since I do not know Rust. If I have any success, I will let you know on this issue.

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

No branches or pull requests

2 participants