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

Does the plugin and the program using the plugin need to be compiled in the same cargo workspace? #5

Open
Atreyagaurav opened this issue Aug 11, 2024 · 0 comments

Comments

@Atreyagaurav
Copy link

Hi,

I tried to follow the examples shown here to make plugins for rust using the C FFI. Unlike the simple example here, the plugins in my use case take some rust structs as &mut Struct and work on that or modify them. Furthermore, the struct are like nodes in a tree so they have references to other structs like their parent and children.

The plugin system was working great when everything was in the same workspace and compiled together. But once I separated the core library to make plugins externally (I'd think that's how people will develop the plugin, and share it.) then suddently I get seg fault when trying to access the struct parent and other components. I think it's because the internal layout of the struct is not same on different compilation events, so checking rustc version and core version didn't help.

Since there are such few information and tutorials on this. I wanted to ask you if you ever did the separate compilation thing. And also is there any actual well-used programs that use this plugin system? If yes, that'd help me immensely while trying to develop mine.

My plan was to develop a plugin system where people can develop and share the .so plugins. But ideally the plugins will be open source and compiled by the user. But having to put all plugins in the same workspace and compiling the program again everytime would be useless, as in that case just adding the "plugins" in the main program's source code with build.rs or something would make it safe.

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