I am trying to build a plugin system in Nim, and trying to figure out if it is possible to create a dynamic library from nim code that could be loaded at runtime from nim.
If there is some other way to make runtime plugins from Nim I would love to know about it.
It would be awesome to see Nim support with Salt (I'm totally hoping that's what this is question is related to).
As far as plugins go, are you wanting to take Nim source and compile that dynamically and then load the compiled code? Or are you wanting to accept binary plugins, but ones that were written in Nim and have some Nim-based API that they are written to?
Also, given your background, you may be interested in some of Nim/Python integration that exists. @jboy has recently published nim-pymod, https://github.com/jboy/nim-pymod , which allows generating a Python wrapper module for a Nim module. Also there is NimBorg, https://github.com/micklat/NimBorg, which allows loading Python code and accessing it from Nim.
Thank you, and yes, I would also like to see nim support in Salt. It is becoming more popular to use Salt for distributed computing tasks, such as big data, hpc and technical computing types of tasks. It would be great to be able to build salt plugins in compiled languages such as Nim and add them to the Salt workflow. I would also like to explore a Nim implementation of the Salt loader (in a Nim style of course) as I have become enamoured with Nim, compared to other modern compiled languages I feel it does the best job of balancing performance with usability, Julia has performance problems unless very carefully constructed, Rust is amazing but does not expose the same level of ease of use that Nim does.
So, I would like to do many things, but primarily I would like to compile Nim code dynamically and then be able to call it in a Nim way from Nim code, so I could distribute nim compiled plugins that could be replaced and reloaded into a running Nim program, much like how the Salt loader works with plugins.
I am also very interested in calling Nim from python, and vis-versa so I could make a Nim program that could make use of the vast Salt libraries for systems management etc.