Skip to content

kslng/plugin-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Involved Plugin System for Rust

Originally designed for KSL, ended up scrapped.

Objective

The objective is to build a lightweight and fast plugin system for Rust that is capable of loading modules during runtime. Due to the involved nature of this project it's unlikely to become a Rust module of any kind.

Performance

Benchmarks are run on exclusively dispatch time. Does not include time required to load dll(s) and extract registered functions.

Function Min Avg Max Iterations
math.ceil_f 10.263 µs 10.297 µs 10.331 µs 250
math.floor_f 9.5970 µs 9.6225 µs 9.6502 µs 250
math.cos_f 11.515 µs 11.560 µs 11.616 µs 250
math.sin_f 11.102 µs 11.126 µs 11.152 µs 250
math.tan_f 11.739 µs 11.774 µs 11.812 µs 250
math.sqrt_f 9.9137 µs 9.9399 µs 9.9673 µs 250

See /benches/benches.rs & /src/plugins/math.c for Reference

Roadmap

  • Dynamically update function index on the C side.
  • Track Plugin ID in RustPlugin struct for individually freeing plugins.
  • Optimize hashmap on the Rust side.
  • Crash detection to free loaded libraries.
  • Add support for Linux.

Notes

Shared enums and structs are in plugin_wrapper.h.

The plugin_wrapper.h file should be included on every library.

Module loading and calling goes through plugin_handler.c which is compiled alongside main.rs with the build.rs file.

To compile the io.dll test file do gcc -c io.c and then gcc -shared -o io.dll io.o.

References

About

Isolated development of a KSL [rust-runtime] plugin-system candidate [scrapped].

Topics

Resources

License

Stars

Watchers

Forks