I've wrapped hundreds of thousands of lines of C and C++ code. The underscores were the least of my worries. ;-)
// file ccall.c
int some_weirdly_named_func(int p)
{
return(p += 10);
}
# file ccaller.nim
{.compile:"ccall.c".}
proc weirdCcall(p: cint) : cint {.importc:"some_weirdly_named_func".}
let r = weirdCcall(3)
echo $r
Note that nim can import "some_weirdly_named_func()" as one is free to name it in Nim as one wishes (in the example weirdCcall). One might as well stick with some_weirdly_named_func but then Nim will treat the Nim version as if one had called it someweirdlynamedfunc - but still call the correct C function.