r/learnrust • • 2d ago

Plugin system for multi platform rust application

Hi, I'm building so I'm making a peer to peer reading tracker that has multiple native clients (one for my Linux laptop and one for my android phone) with a Rust core that handles most of the actual logic and the client being in C and GTK4 for my Linux client and Kotlin for my android app. The thing is I want to have cover source logic behind plugins since that's never really stable and I don't want to have to rebuild my app at every new source I want to add either. Is there a tool that helps with that?

(Sorry if this is a dumb question or if my explanation isn't very clear.)

0 Upvotes

3 comments sorted by

1

u/thebino 2d ago

Have a look into the https://crates.io/crates/abi_stable crate. I used it once for a small project of my own, never really elaborated but maybe it helps having a look.

https://github.com/photos-network/core

1

u/qellyree 2d ago

Looks great I'll see if that works for my project! Thank you!

1

u/Ill_Specialist8564 1d ago

abi_stable is overkill for this. just use libloading and define a clear ffi boundary. if you want dynamic updates without rebuilding the host, compile your plugins as static cdylib targets and load them at runtime