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

Make Rust ABI stable enough to provide plugins functionality #1675

Closed
iddm opened this issue Jul 13, 2016 · 3 comments
Closed

Make Rust ABI stable enough to provide plugins functionality #1675

iddm opened this issue Jul 13, 2016 · 3 comments
Labels
T-compiler Relevant to the compiler team, which will review and decide on the RFC. T-dev-tools Relevant to the development tools team, which will review and decide on the RFC. T-lang Relevant to the language team, which will review and decide on the RFC.

Comments

@iddm
Copy link

iddm commented Jul 13, 2016

Each language has it's own rules of creating a plugins.
In java we can make a project which may open a .jar at runtime to extend the program functionality. In python we could do almost the same thing using native tools. In C++ with Qt we can create a QPlugin/QLibrary which does the same thing. In C we may simply use dlopen.

Now creating an extensible application in rust is problematic:

  1. Traits are not stable.
  2. extern "Rust" is not safe yet too if you switch between compiler versions.

Even if I did not provide much items above, creating a plugin in Rust is very hard and needs a lot of unsafe blocks, checks, hacks and simulations (for example, trait-object simulation). Also everything needs to be C-compliant. As a language user I see that language attempts to be the most simple and safe as possible at the same time. It should have an ability to extend the program's functionality during runtime without using C convention - that would help to avoid unsafe blocks.

Original question was discussed here:
https://users.rust-lang.org/t/how-to-write-plugins-in-rust/

Here and here is some use of hacky-like code to emulate plugin functionality. I believe it works but this is absolutely weird - coding in Rust for Rust with C convention. We must provide a way to make normal, human-oriented way to extend Rust programs in Rust language without any narrowing to C.

P.S. I did not make any RFC yet.

@steveklabnik
Copy link
Member

This is a subset of #600

@DemiMarie
Copy link

One option would be to at least have a way to detect compiler/library mismatches, so that plugin loading can fail.

@nrc nrc added the T-dev-tools Relevant to the development tools team, which will review and decide on the RFC. label Aug 17, 2016
@nrc nrc mentioned this issue Aug 17, 2016
@nrc
Copy link
Member

nrc commented Aug 17, 2016

Closing since this is covered by #600.

@nrc nrc closed this as completed Aug 17, 2016
@nrc nrc added T-lang Relevant to the language team, which will review and decide on the RFC. T-compiler Relevant to the compiler team, which will review and decide on the RFC. labels Aug 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-compiler Relevant to the compiler team, which will review and decide on the RFC. T-dev-tools Relevant to the development tools team, which will review and decide on the RFC. T-lang Relevant to the language team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests

4 participants