Added ORCA_IMPORT to mark symbols imported from the runtime

This commit is contained in:
Martin Fouilleul 2023-06-25 20:17:01 +02:00
parent 28e0a6c88e
commit bc03887148
5 changed files with 19 additions and 14 deletions

View File

@ -24,7 +24,7 @@ typedef struct log_output
static log_output _logDefaultOutput = {.kind = ORCA_LOG_OUTPUT_CONSOLE}; static log_output _logDefaultOutput = {.kind = ORCA_LOG_OUTPUT_CONSOLE};
log_output* LOG_DEFAULT_OUTPUT = &_logDefaultOutput; log_output* LOG_DEFAULT_OUTPUT = &_logDefaultOutput;
extern void orca_log(log_level level, void ORCA_IMPORT(orca_log)(log_level level,
int fileLen, int fileLen,
const char* file, const char* file,
int functionLen, int functionLen,

View File

@ -8,7 +8,7 @@
#include"platform_memory.h" #include"platform_memory.h"
extern void* orca_mem_grow(u64 size); void* ORCA_IMPORT(orca_mem_grow)(u64 size);
void* orca_mem_base_reserve(mem_base_allocator* context, u64 size) void* orca_mem_base_reserve(mem_base_allocator* context, u64 size)
{ {

View File

@ -94,4 +94,9 @@
#define mp_thread_local __thread #define mp_thread_local __thread
#endif #endif
#if PLATFORM_ORCA
#define ORCA_IMPORT(f) __attribute__((import_name(#f))) f
#endif
#endif // __PLATFORM_H_ #endif // __PLATFORM_H_

View File

@ -13,7 +13,7 @@
//NOTE: assert macros //NOTE: assert macros
#ifndef NO_ASSERT #ifndef NO_ASSERT
#ifdef PLATFORM_ORCA #ifdef PLATFORM_ORCA
extern int orca_assert(const char* file, const char* function, int line, const char* src, const char* msg); int ORCA_IMPORT(orca_assert)(const char* file, const char* function, int line, const char* src, const char* msg);
#define _ASSERT_(x, msg) ((x) || orca_assert(__FILE__, __FUNCTION__, __LINE__, #x, msg)) #define _ASSERT_(x, msg) ((x) || orca_assert(__FILE__, __FUNCTION__, __LINE__, #x, msg))
#else #else
#include<assert.h> #include<assert.h>

View File

@ -17,10 +17,10 @@
#define M_PI 3.14159265358979323846 #define M_PI 3.14159265358979323846
double fabs(double x); double ORCA_IMPORT(fabs)(double x);
double sqrt(double sqrt); double ORCA_IMPORT(sqrt)(double sqrt);
double cos(double x); double ORCA_IMPORT(cos)(double x);
double sin(double x); double ORCA_IMPORT(sin)(double x);
#endif #endif