Hey! C programmer trying to use Nim a bit more.
in C, when I want to perform a raw syscall I can just execute
#include <unistd.h>
#include <sys/syscall.h>
int main(void) {
syscall(SYS_write, 1, "hello, world!\n", 14);
return 0;
}
I compiled it on my fedora, this is (clearly) the output
[cat@Fedora~]$ gcc file.c -o file
[cat@Fedora~]$ ./file
hello, world!
How can I perform raw syscalls in Nim? Is that a built in feature?
Thanks in advance <3
its not builtin you need to do importc
proc syscall(arg: cint): cint {.importc, header: "<unistd.h>", varargs.}
var
SYS_write {.importc, header: "<sys/syscall.h>".}: cint
syscall(SYS_write, 1, "hello world\n".cstring, 12)