I just created my first bindings on Nim, I like how this works at a basic level; if anyone wants to try it out without having to go through a lengthy tutorial: //hello.c #include <stdio.h> const char* hello_world() { return "Hello, World!"; } Run # hello.nim # Import the C function {.passL: "libhello.so".} # Link with the shared library # Declare the C function in Nim proc hello_world(): cstring {.importc: "hello_world", dynlib: "libhello.so".} # Use the function echo hello_world() Run
`$gcc -shared -o libhello.so -fPIC hello.c` `$nim c -d:nodebug hello.nim`