[Proposal] Switch to the Universal CRT on Windows.
Kagamin
spam at here.lot
Thu Jul 16 17:05:10 UTC 2026
On Wednesday, 1 July 2026 at 12:37:22 UTC, Dennis wrote:
> In my own code I avoid libc as much as I can, using
> `CreateFileW` instead of `fopen` for example. Only a few
> essentials like memcpy and memset remain since LDC sometimes
> emits calls to that even when you don't write them yourself.
```
extern(C):
void* memset(void* dest, int c, size_t count)
{
RtlFillMemory(dest,count,cast(ubyte)c);
return dest;
}
int memcmp(in char* b1, in char* b2, size_t count)
{
foreach(i;0..count)if(b1[i]!=b2[i])return b1[i]-b2[i];
return 0;
}
void* memmove(void* dst, in void* src, size_t count)
{
RtlMoveMemory(dst,src,count);
return dst;
}
void* memcpy(void* dst, in void* src, size_t count)
{
return memmove(dst,src,count);
}
```
Not sure how slow is this `memcmp` though.
More information about the Digitalmars-d
mailing list