From 8cc930389dc637ed0621feb4c4df01f404a5359b Mon Sep 17 00:00:00 2001 From: lyon Date: Thu, 5 May 2022 21:49:58 +0800 Subject: [PATCH] add _WIN32 to support windows --- src/PikaPlatform.c | 20 ++++++++++---------- tools/pikaCompiler/cross-build.sh | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/PikaPlatform.c b/src/PikaPlatform.c index 9bd9424f6..7f28abb0d 100644 --- a/src/PikaPlatform.c +++ b/src/PikaPlatform.c @@ -100,30 +100,30 @@ PIKA_WEAK void* __platform_memcpy(void* dir, const void* src, size_t size) { } PIKA_WEAK char __platform_getchar(void) { -#ifdef __linux +#if defined(__linux)||defined(_WIN32) return getchar(); #else - __platform_printf("[error]: __platform_function need implementation!\r\n"); + __platform_printf("[error]: __platform_getchar need implementation!\r\n"); while (1) { } #endif } PIKA_WEAK FILE* __platform_fopen(const char* filename, const char* modes) { -#ifdef __linux +#if defined(__linux)||defined(_WIN32) return fopen(filename, modes); #else - __platform_printf("[error]: __platform_function need implementation!\r\n"); + __platform_printf("[error]: __platform_fopen need implementation!\r\n"); while (1) { } #endif } PIKA_WEAK int __platform_fclose(FILE* stream) { -#ifdef __linux +#if defined(__linux)||defined(_WIN32) return fclose(stream); #else - __platform_printf("[error]: __platform_function need implementation!\r\n"); + __platform_printf("[error]: __platform_fclose need implementation!\r\n"); while (1) { } #endif @@ -133,10 +133,10 @@ PIKA_WEAK size_t __platform_fwrite(const void* ptr, size_t size, size_t n, FILE* stream) { -#ifdef __linux +#if defined(__linux)||defined(_WIN32) return fwrite(ptr, size, n, stream); #else - __platform_printf("[error]: __platform_function need implementation!\r\n"); + __platform_printf("[error]: __platform_fwrite need implementation!\r\n"); while (1) { } #endif @@ -146,10 +146,10 @@ PIKA_WEAK size_t __platform_fread(void* ptr, size_t size, size_t n, FILE* stream) { -#ifdef __linux +#if defined(__linux)||defined(_WIN32) return fread(ptr, size, n, stream); #else - __platform_printf("[error]: __platform_function need implementation!\r\n"); + __platform_printf("[error]: __platform_fread need implementation!\r\n"); while (1) { } #endif diff --git a/tools/pikaCompiler/cross-build.sh b/tools/pikaCompiler/cross-build.sh index ca51d0e26..8d1210a78 100644 --- a/tools/pikaCompiler/cross-build.sh +++ b/tools/pikaCompiler/cross-build.sh @@ -10,6 +10,7 @@ cp target/i686-pc-windows-gnu/release/libpikabinder.a libpikabinder cd ../pikaByteCodeGen cp ../pikaCompiler/libpikabinder . -r +rm pikascript/pikascript-core -r cp ../../src pikascript/pikascript-core -r sh cross-win.sh