logoalt Hacker News

omgmajkyesterday at 8:00 AM2 repliesview on HN

I explored the programming language nim a bit deeper for use in game programming with SDL3 bindings, but I came to find out that compiled nim code on Windows often triggers anti-virus because, from what I hear from people, nim is used a lot in malware development currently. Which is a shame because I really like that language. I haven't tested it myself, it's just things I have heard and read. Someone on r/gamedev told me to write the code in nim, generate C code and then compile it with zig cc.

If anyone has any experience with this, please do chime in :)


Replies

archargelodyesterday at 6:22 PM

It's usually code compiled with Mingw that gets AV false-positives in Nim. But, indeed, you can use clang or zigcc compilers instead.

Nim has good support for Clang, so it works by just switching a single flag: `nim c --cc:clang main.nim`

For zigcc - there is a wrapper package you can install with nimble: `nimble install zigcc`

Then you can use it with: `nim c --cc:clang --clang.exe=zigcc --linker.exe=zigcc main.nim`

Of course, you can save the flags in configuration files. You can look at my setup for inspiration [0].

[0] - https://codeberg.org/janAkali/grabnim/src/branch/master/conf...

imadethisyesterday at 8:09 AM

I don't have any nim experience (sorry!) but I'm also exploring SDL3 with odin. I was able to get a naive battleship clone up and working very quickly, pretty neat. Next step is the new SDL3 GPU API.

show 1 reply