Skip to content

Indirect call signature mismatch with MAIN_MODULE=1 #9850

@jeromelaban

Description

@jeromelaban

I'm opening a different bug, even if it was related to #9810 and mentioned in #9562.

The following code does not run properly using 1.39.3:

#include <stdio.h>

long long testAdd(int a, int b)
{
    return a+b;
}

typedef long long (*testAddHandler)(int, int);

int main()
{
    testAddHandler h = &testAdd;
    long long r = h(42, 42);

    printf("Result: %d\n", r);
}

Built with emcc myfile.cpp -s MAIN_MODULE=1.

And fails with the following:

exception thrown: RuntimeError: indirect call signature mismatch,@http://localhost:8000/index.wasm:wasm-function[176]:0x8988
@http://localhost:8000/index.wasm:wasm-function[177]:0x89d4
Module._main@http://localhost:8000/index.js:41584:32
callMain@http://localhost:8000/index.js:52555:15
doRun@http://localhost:8000/index.js:52614:23
run/<@http://localhost:8000/index.js:52625:7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions