I have a question about following Nim compiler/language use case: suppose, I created a library and want to share it's functionality with others. But, I do not want to share the source code, but just a binary distribution plus an interface. This use case can be solved by creating a C-header file with the interface definition.

The question: is there a proper way to share the interface definition using not C, but Nim language?

2017-01-11 19:20:13

You can share a Nim source file containing only the procedure headers. What the body of those procedures should be is up for debate. What comes to mind is leaving the body empty and specifying a importc and dynlib pragma which imports a Nim DLL built by you.

Something in the language to make creation of something like this more seamless would be nice. I bet you could use macros for this.

2017-01-11 21:53:15