Skip to content Skip to sidebar Skip to footer

Emscripten: How Can I Solve Unboundtypeerror

I am trying to build with emscripten a program which uses std::vector and std::map and the compilation is successful. However, when I ran it on the web browser(firefox/chrome), Unb

Solution 1:

Embind doesn't support pointers to primitive types. "Pi" means to "pointer to integer."

If you will always know the size of the array in advance, you could try passing the array as a const reference. e.g.

std::vector<int> intArrayToVector(constint (&input)[100])

Or you can cheat and use an integer parameter for the pointer and use reinterpret_cast to treat it as a pointer. e.g.

std::vector<int> intArrayToVector(uintptr_t input, size_t len){
    constint* ptr = reinterpret_cast<int*>(input);
    ....
}

Or you can use the cwrap API which does support pointers to primitive types.

Post a Comment for "Emscripten: How Can I Solve Unboundtypeerror"