mun icon indicating copy to clipboard operation
mun copied to clipboard

Unclear on how to embed

Open ethindp opened this issue 4 years ago • 2 comments
trafficstars

Apologies if this isn't the right place to ask this, but its very unclear (and it appears to be quite difficult) to find any actual documentation on embedding Mun in anything. There is, of course, the Mun command-line program, but this doesn't really give me much of an idea on -- say -- a simple "hello world" like program that tells me how to get going. My requirements are strict, too, so Mun may not be appropriate:

I am developing a microkernel operating system. An idea I'd like to prototype would be a "dispatch" server that loads plugins either written in a scripting language like Rhai or compiled AOT with Mun or another compiler. Quite a bit of underlying infrastructure will be needed to make this work on the microkernel, which does not (yet) possess such infrastructure, but mocking the environment -- or trying to -- would be a good way of testing to see how it works. So what is a good way of embedding Mun and what crates do I need?

ethindp avatar Jun 30 '21 14:06 ethindp

You’re quite right there is very few documentation with regards to how to embed mun. The closest example is in the book: https://docs.mun-lang.org/ch01-03-hello-hot-reloading.html#mun-embedded-in-rust . You only really need the mun_runtime crate.

Ill leave this issue open as a reminder for us to start adding some examples in the repo!

baszalmstra avatar Jul 01 '21 05:07 baszalmstra

Does mun_runtime work in no_std or does it require std?

You should also consider providing full embedding documentation in future -- something like an "embedding mun" book that gives you all the tips and tricks for compiling and embedding code and all that fancy stuff. I haven't looked at the documentation for each crate in particular so if its well-documented then there won't be as much of a need.

ethindp avatar Jul 02 '21 04:07 ethindp