Even if mruby core works on Windows, any mruby app is may not work if the libraries it depends on don’t compile and run on Windows. Using Rust, we can work towards building an ecosystem that is Windows compatible. This talk walks through building mruby libraries that do that.
Unlike some other languages like JavaScript, Java, or Python, Ruby is not known for it’s ability to run well on Windows. The Windows environment is often treated as a second or third class citizen even though there are many potential users. Part of this is due to Ruby’s strong POSIX oriented standard library. This has mostly been ok since most Ruby applications are hosted and run on UNIX servers.
mruby is a lightweight Ruby that can be linked and embedded inside other applications. Being embeddable means that the runtime host could be Windows. mruby also has no Operating System specific standard library. Since the ecosystem is young, there’s potential for an ecosystem that is Windows friendly. But writing cross platform native extensions in C for mruby is still difficult.
Rust is a modern systems programming language that is fast and built to prevent segfaults and guarantee thread safety. It’s more than just a compiler, it’s a platform that has a great dependency manager and cares about cross compilation out of the box. This makes it a great candidate over C to write native extensions.
In this talk, we’ll go over some basic Rust and how we can integrate this to write mruby libraries that compile on Linux, OS X, and Windows. It’ll dig into not only writing the library code, but also the mruby C API as well as the mruby/Rust binding layer that makes this all possible.