Enable to use BH_VPRINTF macro to redirect stdout output (#560)
Enable to use BH_VPRINTF macro for platform Linux/Windows/Darwin/VxWorks to redirect the stdout output from platform os_printf/os_vprintf, or the wasi output from wasm app to the vprintf like callback function specified by BH_VPRINTF macro of cmake WAMR_BH_VPRINTF variable. Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
@ -23,7 +23,11 @@ os_printf(const char *format, ...)
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
#ifndef BH_VPRINTF
|
||||
ret += vprintf(format, ap);
|
||||
#else
|
||||
ret += BH_VPRINTF(format, ap);
|
||||
#endif
|
||||
va_end(ap);
|
||||
|
||||
return ret;
|
||||
@ -32,6 +36,10 @@ os_printf(const char *format, ...)
|
||||
int
|
||||
os_vprintf(const char *format, va_list ap)
|
||||
{
|
||||
#ifndef BH_VPRINTF
|
||||
return vprintf(format, ap);
|
||||
#else
|
||||
return BH_VPRINTF(format, ap);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user