Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/library_makeDynCall.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mergeInto(LibraryManager.library, {
"i", // The first argument is the function pointer to call
// in the rest of the argument list, one 64 bit integer is legalized into
// two 32 bit integers.
sig.slice(1).replace("j", "ii"),
sig.slice(1).replace(/j/g, "ii")
].join("");

var typeSectionBody = [
Expand Down
10 changes: 7 additions & 3 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -12519,9 +12519,13 @@ def test_warn_once(self):
self.do_runf('main.c', 'warning: foo\ndone\n')

def test_dyncallwrapper(self):
self.set_setting('MAIN_MODULE', 1)
expected = "2 7\ni: 2 j: 8589934599 f: 3.120000 d: 77.120000"
self.do_runf(test_file('test_runtime_dyncall_wrapper.c'), expected)
self.set_setting("MAIN_MODULE", 1)
expected = """\
2 7
i: 2 j: 8589934599 f: 3.120000 d: 77.120000
j1: 8589934599, j2: 30064771074, j3: 12884901891
"""
self.do_runf(test_file("test_runtime_dyncall_wrapper.c"), expected)

def test_compile_with_cache_lock(self):
# Verify that, after warming the cache, running emcc does not require the cache lock.
Expand Down
9 changes: 9 additions & 0 deletions test/test_runtime_dyncall_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ void f2(int i, uint64_t j, float f, double d){
printf("i: %d j: %lld f: %f d: %lf\n", i, j, f, d);
}

void f3(uint64_t j1, uint64_t j2, uint64_t j3){
printf("j1: %lld, j2: %lld, j3: %lld\n", j1, j2, j3);
}


int main(){
EM_ASM({
Expand All @@ -21,4 +25,9 @@ int main(){
var w = createDyncallWrapper("vijfd");
w($0, 2, 7, 2, 3.12, 77.12);
}, f2);

EM_ASM({
var w = createDyncallWrapper("vjjj");
w($0, 7, 2, 2, 7, 3, 3);
}, f3);
}