mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2024-11-26 15:32:05 +00:00
Support va_args in libc-builtin (#1117)
Implement vprintf/sprintf/snprintf wrapper functions for libc-builtin.
This commit is contained in:
parent
9b858c43cb
commit
5ab368dd00
|
@ -1067,6 +1067,9 @@ static NativeSymbol native_symbols_libc_builtin[] = {
|
|||
REG_NATIVE_FUNC(printf, "($*)i"),
|
||||
REG_NATIVE_FUNC(sprintf, "($$*)i"),
|
||||
REG_NATIVE_FUNC(snprintf, "(*~$*)i"),
|
||||
{ "vprintf", printf_wrapper, "($*)i", NULL },
|
||||
{ "vsprintf", sprintf_wrapper, "($$*)i", NULL },
|
||||
{ "vsnprintf", snprintf_wrapper, "(*~$*)i", NULL },
|
||||
REG_NATIVE_FUNC(puts, "($)i"),
|
||||
REG_NATIVE_FUNC(putchar, "(i)i"),
|
||||
REG_NATIVE_FUNC(memcmp, "(**~)i"),
|
||||
|
|
27
wamr-sdk/app/libc-builtin-sysroot/include/stdarg.h
Normal file
27
wamr-sdk/app/libc-builtin-sysroot/include/stdarg.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _WAMR_LIBC_STDARG_H
|
||||
#define _WAMR_LIBC_STDARG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _VA_LIST
|
||||
typedef __builtin_va_list va_list;
|
||||
#define _VA_LIST
|
||||
#endif
|
||||
#define va_start(ap, param) __builtin_va_start(ap, param)
|
||||
#define va_end(ap) __builtin_va_end(ap)
|
||||
#define va_arg(ap, type) __builtin_va_arg(ap, type)
|
||||
|
||||
#define __va_copy(d, s) __builtin_va_copy(d, s)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end of _WAMR_LIBC_STDARG_H */
|
|
@ -26,6 +26,9 @@ wasm_get_sys_tick_ms
|
|||
printf
|
||||
sprintf
|
||||
snprintf
|
||||
vprintf
|
||||
vsprintf
|
||||
vsnprintf
|
||||
puts
|
||||
putchar
|
||||
memcmp
|
||||
|
|
Loading…
Reference in New Issue
Block a user