It compiles on windows now I guess

This commit is contained in:
2026-01-25 14:37:50 +11:00
parent b502184478
commit a18479b21c
2 changed files with 26 additions and 0 deletions

View File

@@ -5,7 +5,9 @@
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#ifndef _WIN32
#include <dlfcn.h>
#endif
#include <stdarg.h>
#include <unistd.h>
@@ -1925,6 +1927,10 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop
}
case EXTERN: {
#ifdef _WIN32
runtimeError(FIXME, "No Windows support for extern, sucker", in, currentInstruction);
#endif
#ifndef _WIN32
if (in->args.length < 1) {
runtimeError(TOO_FEW_ARGS, "Expecting 1 arg", in, currentInstruction);
}
@@ -1974,6 +1980,7 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop
}
initFn(scope);
#endif
break;
}

View File

@@ -5,6 +5,25 @@
#include <string.h>
#include <ctype.h>
#ifdef _WIN32
size_t strnlen(const char *src, size_t n) {
size_t len = 0;
while (len < n && src[len])
len++;
return len;
}
char* strndup(const char *s, size_t n) {
size_t len = strnlen(s, n);
char *p = malloc(len + 1);
if (p) {
memcpy(p, s, len);
p[len] = '\0';
}
return p;
}
#endif
GroundProgram createGroundProgram() {
GroundProgram gp;
gp.size = 0;