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:
Wenyong Huang
2021-03-06 08:29:58 -06:00
committed by GitHub
parent a4239f1ffd
commit a1568825e8
10 changed files with 132 additions and 7 deletions

View File

@ -34,13 +34,21 @@ extern "C" {
#endif
#if defined(MSVC)
__declspec(dllimport) void *BH_MALLOC(unsigned int size);
__declspec(dllimport) void BH_FREE(void *ptr);
__declspec(dllimport) void *BH_MALLOC(unsigned int size);
__declspec(dllimport) void BH_FREE(void *ptr);
#else
void *BH_MALLOC(unsigned int size);
void BH_FREE(void *ptr);
#endif
#if defined(BH_VPRINTF)
#if defined(MSVC)
__declspec(dllimport) int BH_VPRINTF(const char *format, va_list ap);
#else
int BH_VPRINTF(const char *format, va_list ap);
#endif
#endif
#ifndef NULL
#define NULL (void*)0
#endif