lausek / lovm2

lausek's own virtual machine
http://lausek.eu/lovm2
GNU General Public License v3.0
8 stars 0 forks source link

Allow loading custom modules #3

Closed lausek closed 4 years ago

lausek commented 4 years ago

Add a function fn(name: &str) -> Option<Module> to lovm2 that is dispatched whenever the interpreter needs to lookup modules for the Load instruction.

This functionality is needed because pylovm2 can generate modules from python code, but importing them into the vm is not suitable as it would require two mutable references to the vm itself. The new method narrows the mutation down to one reference only.