summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaan <daan@effp.org>2022-10-31 12:16:34 -0700
committerdaan <daan@effp.org>2022-10-31 12:16:34 -0700
commitc4663463d120adafa5ceae25b3c22e49d7fdf18f (patch)
tree1e6fdbfd6ec25161de1a72c760b515d1d82c883b
parent698bb2cae70dbe096d6ece60670ac5e3897f5da2 (diff)
add mi_cdecl to functions to avoid errors when compiling with a different calling convention, see PR #592
-rw-r--r--src/init.c8
-rw-r--r--src/options.c6
-rw-r--r--src/stats.c2
3 files changed, 8 insertions, 8 deletions
diff --git a/src/init.c b/src/init.c
index 1d816fa..49974ba 100644
--- a/src/init.c
+++ b/src/init.c
@@ -448,7 +448,7 @@ void _mi_heap_set_default_direct(mi_heap_t* heap) {
// --------------------------------------------------------
// Run functions on process init/done, and thread init/done
// --------------------------------------------------------
-static void mi_process_done(void);
+static void mi_cdecl mi_process_done(void);
static bool os_preloading = true; // true until this module is initialized
static bool mi_redirected = false; // true if malloc redirects to mi_malloc
@@ -479,8 +479,8 @@ mi_decl_export void _mi_redirect_entry(DWORD reason) {
mi_thread_done();
}
}
-__declspec(dllimport) bool mi_allocator_init(const char** message);
-__declspec(dllimport) void mi_allocator_done(void);
+__declspec(dllimport) bool mi_cdecl mi_allocator_init(const char** message);
+__declspec(dllimport) void mi_cdecl mi_allocator_done(void);
#ifdef __cplusplus
}
#endif
@@ -579,7 +579,7 @@ void mi_process_init(void) mi_attr_noexcept {
}
// Called when the process is done (through `at_exit`)
-static void mi_process_done(void) {
+static void mi_cdecl mi_process_done(void) {
// only shutdown if we were initialized
if (!_mi_process_is_initialized) return;
// ensure we are called once
diff --git a/src/options.c b/src/options.c
index e5951be..c5d5638 100644
--- a/src/options.c
+++ b/src/options.c
@@ -169,7 +169,7 @@ void mi_option_disable(mi_option_t option) {
}
-static void mi_out_stderr(const char* msg, void* arg) {
+static void mi_cdecl mi_out_stderr(const char* msg, void* arg) {
MI_UNUSED(arg);
if (msg == NULL) return;
#ifdef _WIN32
@@ -202,7 +202,7 @@ static void mi_out_stderr(const char* msg, void* arg) {
static char out_buf[MI_MAX_DELAY_OUTPUT+1];
static _Atomic(size_t) out_len;
-static void mi_out_buf(const char* msg, void* arg) {
+static void mi_cdecl mi_out_buf(const char* msg, void* arg) {
MI_UNUSED(arg);
if (msg==NULL) return;
if (mi_atomic_load_relaxed(&out_len)>=MI_MAX_DELAY_OUTPUT) return;
@@ -234,7 +234,7 @@ static void mi_out_buf_flush(mi_output_fun* out, bool no_more_buf, void* arg) {
// Once this module is loaded, switch to this routine
// which outputs to stderr and the delayed output buffer.
-static void mi_out_buf_stderr(const char* msg, void* arg) {
+static void mi_cdecl mi_out_buf_stderr(const char* msg, void* arg) {
mi_out_stderr(msg,arg);
mi_out_buf(msg,arg);
}
diff --git a/src/stats.c b/src/stats.c
index 6d486f4..9a6bb09 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -267,7 +267,7 @@ static void mi_buffered_flush(buffered_t* buf) {
buf->used = 0;
}
-static void mi_buffered_out(const char* msg, void* arg) {
+static void mi_cdecl mi_buffered_out(const char* msg, void* arg) {
buffered_t* buf = (buffered_t*)arg;
if (msg==NULL || buf==NULL) return;
for (const char* src = msg; *src != 0; src++) {