They keyword you seek is "FFI" or "foreign function interface".
The manual has the most info: https://nim-lang.org/docs/manual.html#foreign-function-interface
An older more step by step thing by @Xmonader that touches on only a subset of concerns the manual/compiler address: https://xmonader.github.io/nimdays/day03_libmagic.html
Sometimes the best solution is to take a look at concrete example.
Here are some bindings examples :
https://github.com/SciNim/nimfftw3
https://github.com/Clonkk/nim-cppstl