mkvsynth/mkvsynth — pull request #12 by lukechampine (2014-02-27 01:30:00+00:00)
Title: Plugins

This change introduces plugin support for delbrot. Previously, plugins were *technically* supported by adding them to the dependency list and recompiling, but the new system allows for dynamic loading of plugins without the need to recompile. This allows developers to write video filters in C and distribute them available to end users.

Plugins are packages composed of a .so library file, the source code, and documentation. Users can install plugins by simply extracting the .so file to their `~/.config/mkvsynth/` directory. Source code is provided on both moral and practical grounds, since it enables users on non-x86_64 architectures to recompile the plugin as necessary. In the future, I may write a tool that automatically zips these files together and standardizes the documentation.

Syntax-wise, plugins are loaded and called like so:
```ruby
import foo; # load libfoo.so
foo.bar; # calls function bar defined in plugin foo
```
Since imports are no different from any other statement, they can be put anywhere: in a conditional, in a function body, etc. I realize this is a bit crazy, but it shouldn't cause any errors or excessive memory usage.

The makefile has been modified to create the `~/.config/mkvsynth/` directory, and the `makeplugin` tool has been added to facilitate plugin creation. Documentation on its use can be found in [plugins.md](https://github.com/lukechampine/mkvsynth/blob/plugins/delbrot/plugins.md).