X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=typescript_strings.py;h=0453a79aae2c4661b37709a9fcb9d2b3a12ee2f4;hb=caf86199f09538269930ee679d2852a73671d46f;hp=a12370f4e2b78cc47c8d5836da8d34fc5a2b8d2b;hpb=8fbb9c1f80dbb3d3f5bd3472f2fa8053a8437141;p=ldk-java diff --git a/typescript_strings.py b/typescript_strings.py index a12370f4..0453a79a 100644 --- a/typescript_strings.py +++ b/typescript_strings.py @@ -103,12 +103,12 @@ void *memset(void *s, int c, size_t n); void *memcpy(void *dest, const void *src, size_t n); int memcmp(const void *s1, const void *s2, size_t n); -void __attribute__((noreturn)) abort(void); +extern void __attribute__((noreturn)) abort(void); static inline void assert(bool expression) { if (!expression) { abort(); } } -uint32_t __attribute__((visibility("default"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) { +uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) { return val == 0xdeadbeef0badf00dULL; } @@ -279,10 +279,10 @@ static inline LDKStr str_ref_to_owned_c(const jstring str) { typedef bool jboolean; -uint32_t __attribute__((visibility("default"))) TS_malloc(uint32_t size) { +uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) { return (uint32_t)MALLOC(size, "JS-Called malloc"); } -void __attribute__((visibility("default"))) TS_free(uint32_t ptr) { +void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) { FREE((void*)ptr); } """ @@ -336,8 +336,8 @@ import * as InternalUtils from '../InternalUtils.mjs' assert False # Only called if above is None def get_native_arr_ptr_call(self, ty_info): if ty_info.subty is not None: - return "(" + ty_info.subty.c_ty + "*)(", " + 4)" - return "(" + ty_info.c_ty + "*)(", " + 4)" + return "(" + ty_info.subty.c_ty + "*)(((uint8_t*)", ") + 4)" + return "(" + ty_info.c_ty + "*)(((uint8_t*)", ") + 4)" def get_native_arr_entry_call(self, ty_info, arr_name, idxc, entry_access): return None def cleanup_native_arr_ref_contents(self, arr_name, dest_name, arr_len, ty_info): @@ -355,7 +355,7 @@ import * as InternalUtils from '../InternalUtils.mjs' return "str_ref_to_owned_c(" + var_name + ")" def c_fn_name_define_pfx(self, fn_name, have_args): - return " __attribute__((visibility(\"default\"))) TS_" + fn_name + "(" + return " __attribute__((export_name(\"TS_" + fn_name + "\"))) TS_" + fn_name + "(" def wasm_import_header(self, target): res = """ @@ -364,9 +364,6 @@ imports.env = {}; var js_objs: Array> = []; var js_invoke: Function; -imports.env["abort"] = function () { - console.error("ABORT"); -}; imports.wasi_snapshot_preview1 = { "fd_write" : () => {