unit_test failed.
I run the unit_test.c in arm clang. test_printf fail because "%M" point to jsonrpc_print_methods.
Care to share the output?
#define MJSON_ENABLE_RPC 0
run the main in unit_test.c, and run code
{ char *s = NULL; const char *fmt = "{\"a\":%d, \"b\":%u, \"c\":%ld, \"d\":%lu, \"e\":%M}"; ASSERT(mjson_printf(&mjson_print_dynamic_buf, &s, fmt, -1, 3456789012, (long) -1, (unsigned long) 3456789012, f1, 1234) == 60); ASSERT(s != NULL); str = "{\"a\":-1, \"b\":3456789012, \"c\":-1, \"d\":3456789012, " "\"e\":[1234]}"; ASSERT(memcmp(s, str, 60) == 0); free(s); }
when code run to } else if (fc == 'M') { mjson_vprint_fn_t vfn = va_arg(*ap, mjson_vprint_fn_t); n += vfn(fn, fnd, ap); }
vfn should point to f1, but vfn point to 0xCE0A6A14 which isn't a funciton.
I have added an armlinux target which builds and tests on aarch64 linux - and tests pass:
make -C test armlinux
What hardware are you using? Is that a raspi or cortex-m device?
My hardware is stm32f103 and mdk IDE, compiler is armclang 6.
Thank you @tercelcn . Is there any chance to try it with GCC, just to narrow down the issue to armclang?