[PD-dev] Pure Rust Pure Data Externals

x nor x37v.alex at gmail.com
Tue Jul 30 17:49:36 CEST 2019


This is very much still a work in progress, but recently I've been working
on writing pure data externals in Rust and I figured I'd share:

https://github.com/x37v/puredata-rust

Rust can create dynamic libraries that can be loaded in C based projects
without the need for any external build tools, building simply uses rusts
`cargo` build system (and package manager).
I've setup the automatic binding to `m_pd.h` (puredata-sys), some ease of
use classes for creating externals, and a macro that generates a bunch of
boiler plate code so you don't have to.

With this I've created Rust versions of the 4 example externals from the
HOWTO:
https://github.com/pure-data/externals-howto
https://github.com/x37v/puredata-rust/tree/develop/examples

With the help of a macro and attributes, beyond the dependency setup, this
is all you need to write a signal external:
https://github.com/x37v/puredata-rust/blob/develop/examples/xfade/src/lib.rs
or a control external:
https://github.com/x37v/puredata-rust/blob/develop/examples/complex_counter/src/lib.rs

Anyways, I figured I'd share in case anyone else is interested, maybe wants
to contribute or just use it themselves.
I'm tired/done with c/c++ and Rust has presented itself as a great
alternative for a lot of situations.
It was fun to discover that I can generate pure data externals with Rust
and its build system.

--Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20190730/ddf0a2d9/attachment.html>


More information about the Pd-dev mailing list