From 8ed5164dda0902f806ebf65b16a70d02fbae0432 Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Thu, 6 Nov 2025 23:36:58 -0500 Subject: [PATCH 1/2] fix addEmJs when parameter is indirect pointer --- src/lib/libdylink.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/libdylink.js b/src/lib/libdylink.js index 50020af24a7fc..f1a4b6f57fa9e 100644 --- a/src/lib/libdylink.js +++ b/src/lib/libdylink.js @@ -880,7 +880,7 @@ var LibraryDylink = { cSig = cSig.split(','); for (var arg of cSig) { var jsArg = arg.split(' ').pop(); - jsArgs.push(jsArg.replace('*', '')); + jsArgs.push(jsArg.replaceAll('*', '')); } } var func = `(${jsArgs}) => ${body};`; From af6f173d35596f475d4ca2da188d14decb07de1e Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Mon, 10 Nov 2025 23:30:12 -0500 Subject: [PATCH 2/2] add test --- test/other/test_em_js_main.out | 1 + test/other/test_em_js_side.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/test/other/test_em_js_main.out b/test/other/test_em_js_main.out index eb0ab8066d2b9..66124f6fd3377 100644 --- a/test/other/test_em_js_main.out +++ b/test/other/test_em_js_main.out @@ -2,3 +2,4 @@ in main hello from side module 42 + hello hello again hello from void func +indirect ptr value: 0 diff --git a/test/other/test_em_js_side.c b/test/other/test_em_js_side.c index 11844c452a06a..5c9ed73e027e1 100644 --- a/test/other/test_em_js_side.c +++ b/test/other/test_em_js_side.c @@ -14,9 +14,14 @@ EM_JS(void, js_side_func_void, (), { out(`hello from void func`); }); +EM_JS(void, js_side_func_indirect_ptr, (char **pptr), { + out(`indirect ptr value: ${pptr}`); +}); + int test_side() { js_side_func(42, "hello"); js_side_func2("hello again"); js_side_func_void(); + js_side_func_indirect_ptr(NULL); return 0; }