Comments (4)
With -sWASM64
we convert all incoming pointers to number
(technically a 53 bit integer which we refer to as int53 internally) when they arrive on the JS side. In other words, from JS code, pointers should still be number
.
How are you receiving the pointer value that you are passing to UTF8ToString
?
from emscripten.
That's very interesting, maybe it's just my fault. I tried to narrow it down to a very simple PoC:
main.cpp
#include <vector>
extern "C" {
extern int testWasm64ToString(const char **pUrls);
}
int main() {
std::vector<const char*> v = {"abc", "abc"};
return testWasm64ToString(v.data());
}
helper.js
(function() {
var Test = {
testWasm64ToString: function(data) {
var result = UTF8ToString(data);
return 0;
},
};
mergeInto(LibraryManager.library, Test);
})();
I compiled the program with: em++ main.cpp -sMEMORY64=1 --js-library helper.js -o test.html
Thank you for your ongoing support!
from emscripten.
The fix here would be to add a __sig
entry to your testWasm64ToString
function in the JS library.
Something like testWasm64ToString__sig: 'ip'
. This says the return value is an i
(integer) and the first and only argument is ap
(pointer). This will enable emscripten to automatically convert the incoming bigint value to an integer.
from emscripten.
Thanks, that works perfectly!
from emscripten.
Related Issues (20)
- Did 3.1.56 get mis-tagged? HOT 2
- Link time slowdown in an optimized build HOT 10
- Memory corruption/segfault with MINIMAL_RUNTIME + std::thread + thread_local variables
- [request] standalone version of file_packager.py HOT 17
- Update llvm libraries to 18.1.1 HOT 4
- ubsan.test_longjmp_zero is failing HOT 2
- loading-workers error HOT 2
- emprofile generates an HTML with a syntax error HOT 1
- WebGPU: Missing enumeration(s) in WGPUBlendFactor compared to Dawn HOT 1
- SAFE_HEAP should default maximum memory to 1 block less than 2GB HOT 4
- Uncaught TypeError: Failed to execute 'uniform4fv' on 'WebGL2RenderingContext': Overload resolution failed. HOT 9
- /dev/zero is missing HOT 1
- undefined symbol `__cpp_exception` without enabled exceptions HOT 2
- emscripten_dlopen fails on Safari HOT 12
- std::vector<MyBoundType> returns UnboundTypeError HOT 5
- Crashes / misexecutions or miscompilations with growable memory and atomics HOT 37
- dlopen + pthreads with FS not working HOT 1
- CGAL freezes on boolean operations HOT 1
- WebSerial not getting enough time to write to SerialPort HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emscripten.