the code is error:
extern (C) nothrow @nogc size_t syscall(size_t ident);
extern (C) nothrow @nogc size_t syscall(size_t ident, size_t arg0);
extern (C) nothrow @nogc size_t syscall(size_t ident, long* arg0);

long tid;
syscall(SYS_thr_self, &tid);
writeln(tid);

Error: Function type does not match previously declared function with the same mangled name: syscall


Change to:
extern (C) nothrow @nogc size_t syscall(size_t ident);
extern (C) nothrow @nogc size_t syscall(size_t ident, size_t arg0);
extern (C) nothrow @nogc size_t syscall(size_t ident, long* arg0);

long tid;
syscall(SYS_thr_self, &tid);
writeln(tid);

Error: none of the overloads of syscall are callable using argument types (int, long*), candidates are:
source/app.d(3,33):        kiss.sys.syscall.syscall(ulong ident)
source/app.d(4,33): kiss.sys.syscall.syscall(ulong ident, ulong arg0)



Change to:
// extern (C) nothrow @nogc size_t syscall(size_t ident);
// extern (C) nothrow @nogc size_t syscall(size_t ident, size_t arg0);
extern (C) nothrow @nogc size_t syscall(size_t ident, long* arg0);

long tid;
syscall(SYS_thr_self, &tid);
writeln(tid);

result:

100567



Reply via email to