You can do everything with Nim that you can do with C. So yes. There are two main ways to link with a .dll, by including the .h file and importing the types and definitions and possibly linking with a .lib file. See: <https://livebook.manning.com/book/nim-in-action/chapter-8/60>
There is another way were you just dynamically link with .dll without .h or .lib file which I prefer more. But you have to match "binary" api and types exactly as the .h file will not help you. See: <https://github.com/treeform/windy/blob/master/src/windy/platforms/win32/windefs.nim> But it looks like Nim already supports a little bit of what you want with `setControlCHook` see: <https://nim-lang.org/docs/system.html#setControlCHook%2Cproc> maybe looking at source will unlock more?