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,14 +24,14 @@ typedef struct log_output
static log_output _logDefaultOutput = {.kind = ORCA_LOG_OUTPUT_CONSOLE};
log_output* LOG_DEFAULT_OUTPUT = &_logDefaultOutput;
extern void orca_log(log_level level,
int fileLen,
const char* file,
int functionLen,
const char* function,
int line,
int msgLen,
const char* msg);
void ORCA_IMPORT(orca_log)(log_level level,
int fileLen,
const char* file,
int functionLen,
const char* function,
int line,
int msgLen,
const char* msg);
typedef struct orca_log_context
{

View File

@ -8,7 +8,7 @@
#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)
{

View File

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

View File

@ -13,7 +13,7 @@
//NOTE: assert macros
#ifndef NO_ASSERT
#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))
#else
#include<assert.h>

View File

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