Everything needed to run simple Rust programs (#40)

* Everything needed to run simple Rust programs

* Add IsDBCSLeadByte implementation

* Address PR comments
This commit is contained in:
2023-09-09 23:07:23 -04:00
committed by GitHub
parent 6e18120410
commit 94b44fd697
18 changed files with 1106 additions and 151 deletions

31
dll/vcruntime.cpp Normal file
View File

@@ -0,0 +1,31 @@
#include "common.h"
namespace vcruntime {
void *WIN_ENTRY memcpy(void *dest, const void *src, size_t count) { return ::memcpy(dest, src, count); }
void *WIN_ENTRY memset(void *dest, int ch, size_t count) { return ::memset(dest, ch, count); }
int WIN_ENTRY memcmp(const void *buf1, const void *buf2, size_t count) { return ::memcmp(buf1, buf2, count); }
} // namespace vcruntime
static void *resolveByName(const char *name) {
if (strcmp(name, "memcpy") == 0)
return (void *)vcruntime::memcpy;
if (strcmp(name, "memset") == 0)
return (void *)vcruntime::memset;
if (strcmp(name, "memcmp") == 0)
return (void *)vcruntime::memcmp;
return nullptr;
}
wibo::Module lib_vcruntime = {
(const char *[]){
"vcruntime140",
"vcruntime140.dll",
nullptr,
},
resolveByName,
nullptr,
};