More wasm details, deal with requirements for -sMAIN_MODULE

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2022-07-09 23:11:02 +01:00
parent c3f271d9e9
commit d1d08e4704
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
12 changed files with 112 additions and 40 deletions

View file

@ -30,16 +30,19 @@
#include_next "common.hpp"
// Workaround for wrong file permissions from zstd extraction
// Workaround for wrong file permissions from zstd extraction and system usage
#ifdef __EMSCRIPTEN__
#define fopen fopen_wasm
#define system system_wasm
extern "C" {
FILE* fopen_wasm(const char* filename, const char* mode);
inline int system_wasm(const char*) { return 0; }
}
namespace std {
using ::fopen_wasm;
using ::system_wasm;
}
#endif

View file

@ -17,16 +17,13 @@
#pragma once
#ifdef __HAIKU__
// these are missing from HaikuOS
#define pthread_setname_np(...)
static int pthread_getcpuclockid(pthread_t, clockid_t* const clock_id)
int pthread_getcpuclockid(pthread_t, clockid_t* const clock_id)
{
*clock_id = CLOCK_REALTIME;
return 0;
}
#endif
static int backtrace(void**, int)
{