Re: Which type of webhosting is required for Emscripten projects?

2019-05-02 Thread Jack Dale
Thanks for your answer. 1 Mayıs 2019 Çarşamba 23:39:51 UTC+3 tarihinde Brion Vibber yazdı: > > On Wed, May 1, 2019 at 12:00 PM Jack Dale > wrote: > >> Which type of webhosting do I need to run an Emscripten project, what are >> the requirements? >> > > Most web hosting should work as long as

Re: Remain an unused import function in wasm

2019-05-02 Thread Floh
PS: I've been looking around a bit, and maybe this is the better solution (via __attribute__(...)): __attribute__((visibility("default"))) void foo(void); This should be the clang equivalent to __declspec(dllimport) in the Visual Studio compiler, see here:

Re: Remain an unused import function in wasm

2019-05-02 Thread Duan Bing
Thanks, your new idea works for me. the motivation of doing this is that I will call this imported function while I will insert some wasm code to the original wasm file later, similar to this project had done https://github.com/ewasm/wasm-metering , but by a different PL. so I don't want the

Re: Remain an unused import function in wasm

2019-05-02 Thread Floh
Ah ok, I misunderstood your question, apologies. I don't know how one would add a function declaration to the WASM imports table like this. EMSCRIPTEN_KEEPALIVE and the "-s EXPORTED_FUNCTIONS" linker option would work for the "other side" (some WASM module exporting functions to the outside).

Re: Remain an unused import function in wasm

2019-05-02 Thread Duan Bing
Thanks, Floh. it works when the function is defined. Actually, my function is an external function declaration, like extern "C" void foo(); It doesn't work even I declare like this: extern "C" void EMSCRIPTEN_KEEPALIVE foo(). Do you have any idea for this situation? Floh 于2019年5月2日周四

Re: Reading files on demand

2019-05-02 Thread Floh
If you don't need the fopen/fread/fclose functions, the easiest way to load data on demand is emscripten_async_wget_data(): https://emscripten.org/docs/api_reference/emscripten.h.html#c.emscripten_async_wget_data ...this performs a XmlHttpRequest and on success invokes a callback function

Re: Remain an unused import function in wasm

2019-05-02 Thread Floh
Have a look at EMSCRIPTEN_KEEPALIVE: https://emscripten.org/docs/api_reference/emscripten.h.html#c.EMSCRIPTEN_KEEPALIVE, this prevents a C/C++ function from being removed even when it isn't referenced by other C/C++ code (normally this is used to call C functions from the JS side). On

Re: How to implement file reading chunk for chunk now that SPLIT_MEMORY is gone?

2019-05-02 Thread Floh
Assuming you don't need the entire file at the same time in memory, I would allocate a fixed size memory block (let's say a couple of megabytes), and in a loop, perform "HTTP range requests" into this fixed buffer until the whole file has been processed. The emscripten fetch API seems to have

Re: Reading files on demand

2019-05-02 Thread Woof
On Thursday, 2 May 2019 01:52:21 UTC+2, Zajo wrote: Is there any way to open files hosted on a web server and read them > synchronously on demand > If it helps we lazily load files into Emscripten's MEMFS. For example, create the in-memory file system with some help from JavaScript:

Remain an unused import function in wasm

2019-05-02 Thread Duan Bing
I declare an external function in C source file, but never used by the code, then compile it to wasm by EMCC. there is no doubt the external function will be eliminated by the compiler. Is there any approach to keep this external function and then be compiled to an import function in wasm? The