diff --git a/vlib/builtin/cfns.c.v b/vlib/builtin/cfns.c.v index b616319b62..ba7086f049 100644 --- a/vlib/builtin/cfns.c.v +++ b/vlib/builtin/cfns.c.v @@ -27,12 +27,9 @@ fn C.popen(c byteptr, t byteptr) voidptr // // backtrace functions are not #included, that's why they have to be defined without C. -fn backtrace(a voidptr, b int) int - -fn backtrace_symbols(voidptr, int) &byteptr - - -fn backtrace_symbols_fd(voidptr, int, int) +fn backtrace(a &voidptr, b int) int +fn backtrace_symbols(a &voidptr, size int) &charptr +fn backtrace_symbols_fd(a &voidptr, size int, fd int) void // fn proc_pidpath(int, voidptr, int) int diff --git a/vlib/v/gen/cheaders.v b/vlib/v/gen/cheaders.v index ae5b2e827d..c09f8323a3 100644 --- a/vlib/v/gen/cheaders.v +++ b/vlib/v/gen/cheaders.v @@ -69,7 +69,20 @@ typedef int (*qsort_callback_func)(const void*, const void*); #ifdef __cplusplus #include #define _MOV std::move -#include +#endif + +#if defined(__ANDROID__) +int backtrace (void **__array, int __size) { return 0; } +char **backtrace_symbols (void *const *__array, int __size){ return 0; } +void backtrace_symbols_fd (void *const *__array, int __size, int __fd){} +#else +#ifndef _WIN32 +#if defined __has_include +#if __has_include () +# include +#endif +#endif +#endif #endif //#include "fns.h" diff --git a/vlib/v/gen/fn.v b/vlib/v/gen/fn.v index 4ccd25b084..5bd5161d79 100644 --- a/vlib/v/gen/fn.v +++ b/vlib/v/gen/fn.v @@ -22,6 +22,12 @@ fn (mut g Gen) gen_fn_decl(it ast.FnDecl) { if g.attr == 'inline' { g.write('inline ') } + if it.name in ['backtrace', 'backtrace_symbols', 'backtrace_symbols_fd'] { + // these are actually defined as C functions in execinfo.h + // TODO: remove this check, *after* they are defined as C. in cfns.c.v + // in bootstrap phase 2 + return + } // is_livefn := g.attr == 'live' is_livemain := g.pref.is_livemain && is_livefn