http://rosettacode.org/wiki/Call_a_foreign-language_function...
http://rosettacode.org/wiki/Call_a_function_in_a_shared_libr...
http://rosettacode.org/wiki/Use_another_language_to_call_a_f...
Making c2nim work with header files can be a bit difficult. The main information is here: http://nimrod-lang.org/c2nim.html
When something throws an error I comment it out and try to see if I can fix it up by hand.
Importing a standard procedure from a C library like GMP actually is pretty easy (use the importc/header pragmas).
Here's what tripped me up:
* Calling variadic functions from Nimrod (just wrote a wrapper)
* Getting to link against gmp (used the passL: "-lgmp" pragma)
* Remembering to free what was allocated by C library functions (can't GC what you didn't allocate) - caught with valgrind
I'll probably push to my github repo, but can post to a pastebin or something if there's interest in a less cookie-cutter example
I think that I could use the 'importc'/'dynlib' with the compiled library, but there's not a whole lot of documentation on that in the Nimrod manual, and I ended up just doing that problem in C because it was easier (read: I was lazier) to get working.