What is the __udivdi3 __umoddi3 function?
lili
akozhao at tencent.com
Thu Aug 22 20:20:00 UTC 2019
Hi
I writing a OS in D, compile with -betterC -c, but when call a
variable template function
where has __udivdi3 __umoddi3 undefined symbol, can not link
with ld, how to resolve it.
see code below
println('it is ok');
println('it is occur -_udivdi3 symbol', 33);
void println(A...)(A a)
{
char[20] numStr = void;
import std.traits;
foreach(v ; a) {
alias UV = Unqual!(typeof(v));
static if (is(UV == char)) putc(v);
else static if (is(UV == char*)) puts(v);
else static if (is(typeof(v) == string)) puts(v.ptr);
else static if (is(UV == bool)) puts(v ?
"true":"false");
else static if (is(UV == byte) || is(UV == ubyte) ||
is(UV == short) || is(UV == ushort) ||
is(UV == int) || is(UV == uint) ||
is(UV == long) || is(UV == ulong))
{
ulong n = cast(ulong)v;
bool isNeg = false;
if (v < 0) {
isNeg = true;
if (n != 1UL<<63)
n = -v;
}
int i=0;
while(n !=0 ) {
numStr[i++] = (n%10) + '0';
n/=10;
}
if (isNeg)
putc('-');
while (--i >= 0)
putc(numStr[i]);
}
else
static assert(false);
}
}
More information about the digitalmars-d-ldc
mailing list