emscripten-core / emscripten-core/emscripten

embind __embind_register_std_string error when memory64

Open
#24,323 1 comment 0 reactions 1 assignee Claimed by @brendandahl View on GitHub
embind
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Please include the following in your bug report:

**Version of emscripten/emsdk:**
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.3 (a9651ff57165f5710bb09a5fe52590fd6ddb72df)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

**Failing command line in full:**
When using memory64 in Embind, in the __embind_register_std_string function generated by Embind, the line var length = HEAPU64[((value)/8)]; will encounter an error because value is of BigInt type. The operation bigint/8 throws an error: Error: Cannot mix BigInt and other types, use explicit conversions.

```js
function __embind_register_std_string(rawType, name) {
rawType = bigintToI53Checked(rawType);
name = bigintToI53Checked(name);


name = readLatin1String(name);
var stdStringIsUTF8
= true;

registerType(rawType, {
name,
// For some method names we use string keys here since they are part of
// the public/external API and/or used by the runtime-generated code.
'fromWireType'(value) {
var length = HEAPU64[((value)/8)];
var payload = value + 8;
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.