Can we do system calls like that in D?

Adam D Ruppe destructionator at gmail.com
Tue Nov 9 12:28:59 UTC 2021


On Tuesday, 9 November 2021 at 11:52:10 UTC, rempas wrote:
> It's an attribute. I'm talking specifically about the 
> `@extern(syscall, <num>)` attribute that let's you make an 
> system call and bind it under a name without having any library 
> linked or without having to write any assembly. Is this 
> possible in D?

I'd be very easy to do that as a library mixin. You'd write

@syscall(45) void whatever();

mixin BindSyscalls;

and then the library generates the bodies as inline asm.


More information about the Digitalmars-d-learn mailing list