Hi everyone. I am writing a Polyglot Runtime ( https://github.com/metacall/core ) and I just wrote a wrapper for the C API with Nim.
This means that now you can use multiple libraries from other languages in Nim. The wrapper is very simple and it's far away to be completed ( https://github.com/metacall/core/tree/develop/source/ports/nim_port ) but it is a Proof of Concept. My idea would be to implement a more elegant and type safe interface based on templates (or similar). I am not experienced in Nim so anybody interested having full interoperability with other languages can work with it and PR it. I will review and merge all the improvements.
I wrote a small unit test too ( https://github.com/metacall/core/blob/develop/source/ports/nim_port/test.nim ) in order to demonstrate how to call NodeJS functions (and also, executing an 'eval'). It can also load any js file but for making the test simpler I just made it inlined.
Any questions or suggestions are welcome. I hope this can help to the Nim ecosystem meanwhile it is not fully mature.
Respect to the package itself, how can I publish it? I have been reading this: https://github.com/nim-lang/nimble#publishing-packages ; but I am not sure how to publish a package that has a C library dependency.
Respect to the package itself, how can I publish it? I have been reading this: https://github.com/nim-lang/nimble#publishing-packages ; but I am not sure how to publish a package that has a C library dependency.
You can tweak your .nimble file to perform operation on nimble install` using ``after_install task in nimble and from there compile & run a Nim file (or a bash script if you don't care about portability) that setup every "external" stuff that you wish to distribute.
It's more of a workaround because Nimble doesn't have an easy to distribute or deploy shared library or header easily