digitalmars.D.learn - Can I make system calls directly from D?
- rempas (2/2) Jul 09 2021 I just wonder if I'm able to do system calls directly from D or
- Ferhat =?UTF-8?B?S3VydHVsbXXFnw==?= (6/8) Jul 09 2021 I don't know if it covers what you want but, druntime has those
- rempas (4/12) Jul 09 2021 Yep! From my understanding, this is binding from C so at least I
- Dennis (13/15) Jul 09 2021 If with directly means 'without calling any C function' you can
- rempas (5/20) Jul 09 2021 This is the most "direct" way possible. However I should probably
I just wonder if I'm able to do system calls directly from D or If I have to create bindings from "unistd.h" from C
Jul 09 2021
On Friday, 9 July 2021 at 08:08:57 UTC, rempas wrote:I just wonder if I'm able to do system calls directly from D or If I have to create bindings from "unistd.h" from CI don't know if it covers what you want but, druntime has those definitions: https://github.com/dlang/druntime/blob/master/src/core/sys/posix/unistd.d import core.sys.posix.unistd; ... do stuff
Jul 09 2021
On Friday, 9 July 2021 at 08:18:51 UTC, Ferhat Kurtulmuş wrote:On Friday, 9 July 2021 at 08:08:57 UTC, rempas wrote:Yep! From my understanding, this is binding from C so at least I don't have to make them on my own. Thanks a lot for your time, have an amazing day!I just wonder if I'm able to do system calls directly from D or If I have to create bindings from "unistd.h" from CI don't know if it covers what you want but, druntime has those definitions: https://github.com/dlang/druntime/blob/master/src/core/sys/posix/unistd.d import core.sys.posix.unistd; ... do stuff
Jul 09 2021
On Friday, 9 July 2021 at 08:08:57 UTC, rempas wrote:I just wonder if I'm able to do system calls directly from D or If I have to create bindings from "unistd.h" from CIf with directly means 'without calling any C function' you can use inline assembly: ```D version(linux) void rt_sigreturn() { version(D_InlineAsm_X86_64) asm { naked; mov EAX, 15; syscall; } } ```
Jul 09 2021
On Friday, 9 July 2021 at 08:28:25 UTC, Dennis wrote:On Friday, 9 July 2021 at 08:08:57 UTC, rempas wrote:This is the most "direct" way possible. However I should probably not mess with assembly at this point and use the built-in D header file for unistd. Thanks a lot for your time tho, have a great day!I just wonder if I'm able to do system calls directly from D or If I have to create bindings from "unistd.h" from CIf with directly means 'without calling any C function' you can use inline assembly: ```D version(linux) void rt_sigreturn() { version(D_InlineAsm_X86_64) asm { naked; mov EAX, 15; syscall; } } ```
Jul 09 2021