Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <wasm.h>
- #include <wasmtime.h>
- #if INF_DEBUG_PROBE_STANDALONE
- void Logf(const char *format, ...);
- #else
- #define Logf printf
- #endif
- int main()
- {
- wasm_config_t* wasm_config = wasm_config_new();
- wasmtime_config_debug_info_set(wasm_config, true);
- wasm_engine_t *engine = wasm_engine_new_with_config(wasm_config);
- Logf("wasm_functype_new_1_1[before].\n");
- wasm_valtype_t* val_i32 = wasm_valtype_new(WASM_I32);
- wasm_functype_t *__ft_i32_out_i32 = wasm_functype_new_1_1(val_i32, val_i32);
- Logf("wasm_functype_new_1_1[after].\n");
- return 0;
- }
- #if INF_DEBUG_PROBE_STANDALONE
- #ifdef INF_DEBUG
- #pragma comment(lib, "..\\..\\..\\..\\target\\debug\\wasmtime.dll.lib")
- #else
- #pragma comment(lib, "..\\..\\..\\..\\target\\release\\wasmtime.dll.lib")
- #endif
- #include <windows.h>
- int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
- {
- main();
- return 0;
- }
- #endif
- #if INF_DEBUG_PROBE_STANDALONE
- #include <windows.h>
- #include <stdio.h>
- void Logf(const char *format, ...)
- {
- va_list arg_list;
- va_start(arg_list, format);
- // Do the format once to get the length.
- #if defined _WIN32 || defined _WIN64 /// COMPILER(MSVC)
- int len = _vscprintf(format, arg_list);
- #else
- char ch;
- int len = vsnprintf(&ch, 1, format, arg_list);
- // We need to call va_end() and then va_start() again here, as the
- // contents of args is undefined after the call to vsnprintf
- // according to http://man.cx/snprintf(3)
- // Not calling va_end/va_start here happens to work on lots of systems, but fails on some systems e.g. 64 bit Linux.
- va_end(arg_list);
- va_start(arg_list, format);
- #endif
- // Ensure we have enough room.
- char *tmp = malloc(len+1);
- vsprintf(tmp, format, arg_list);
- va_end(arg_list);
- MessageBoxA(NULL, tmp, "repro", MB_OK);
- free(tmp);
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment