From dea19fe3c3493131704e3d9461bf6af349d386e9 Mon Sep 17 00:00:00 2001 From: ValKmjolnir Date: Wed, 11 Dec 2024 20:52:58 +0800 Subject: [PATCH] :fire: move NASAL_EXPORT to nasal.h --- module/fib.cpp | 2 +- module/keyboard.cpp | 2 +- module/matrix.cpp | 2 +- module/nasocket.cpp | 2 +- src/nasal.h | 10 +++++++++- src/nasal_gc.h | 9 --------- src/nasal_web.h | 6 ------ 7 files changed, 13 insertions(+), 20 deletions(-) diff --git a/module/fib.cpp b/module/fib.cpp index 36cee41..99f2341 100644 --- a/module/fib.cpp +++ b/module/fib.cpp @@ -124,7 +124,7 @@ module_func_info func_tbl[] = { } -NASAL_EXTERN module_func_info* get() { +NASAL_EXPORT module_func_info* get() { return fib_module::func_tbl; } diff --git a/module/keyboard.cpp b/module/keyboard.cpp index 875ed9a..33e830e 100644 --- a/module/keyboard.cpp +++ b/module/keyboard.cpp @@ -111,7 +111,7 @@ module_func_info func_tbl[] = { {nullptr, nullptr} }; -NASAL_EXTERN module_func_info* get() { +NASAL_EXPORT module_func_info* get() { return func_tbl; } diff --git a/module/matrix.cpp b/module/matrix.cpp index 3108427..7485f0a 100644 --- a/module/matrix.cpp +++ b/module/matrix.cpp @@ -295,7 +295,7 @@ module_func_info func_tbl[] = { {nullptr, nullptr} }; -NASAL_EXTERN module_func_info* get() { +NASAL_EXPORT module_func_info* get() { return func_tbl; } diff --git a/module/nasocket.cpp b/module/nasocket.cpp index 41f843c..3c1ace4 100644 --- a/module/nasocket.cpp +++ b/module/nasocket.cpp @@ -262,7 +262,7 @@ module_func_info func_tbl[] = { {nullptr, nullptr} }; -NASAL_EXTERN module_func_info* get() { +NASAL_EXPORT module_func_info* get() { return func_tbl; } diff --git a/src/nasal.h b/src/nasal.h index fb5ed9f..4e86914 100644 --- a/src/nasal.h +++ b/src/nasal.h @@ -1,7 +1,7 @@ #pragma once #ifndef __nasver__ -#define __nasver__ "11.3" +#define __nasver__ "11.3.1" #endif #include @@ -19,3 +19,11 @@ using f64 = double; // virtual machine stack depth, both global depth and value stack depth const u32 VM_STACK_DEPTH = UINT16_MAX; + +// avoid error loading function bug in MSVC version nasal.exe +#ifdef _MSC_VER + // and fuck MSVC again + #define NASAL_EXPORT extern "C" __declspec(dllexport) +#else + #define NASAL_EXPORT extern "C" __attribute__((visibility("default"))) +#endif diff --git a/src/nasal_gc.h b/src/nasal_gc.h index 399773e..5312d60 100644 --- a/src/nasal_gc.h +++ b/src/nasal_gc.h @@ -126,13 +126,4 @@ struct module_func_info { // module function "get" type typedef module_func_info* (*get_func_ptr)(); - -// avoid error loading function bug in MSVC version nasal.exe -#ifdef _MSC_VER - // and fuck MSVC again - #define NASAL_EXTERN extern "C" __declspec(dllexport) -#else - #define NASAL_EXTERN extern "C" -#endif - } diff --git a/src/nasal_web.h b/src/nasal_web.h index 3bc7d98..8de3ee8 100644 --- a/src/nasal_web.h +++ b/src/nasal_web.h @@ -3,12 +3,6 @@ #include "nasal.h" -#ifdef _WIN32 - #define NASAL_EXPORT __declspec(dllexport) -#else - #define NASAL_EXPORT __attribute__((visibility("default"))) -#endif - #ifdef __cplusplus extern "C" { #endif