Hi Jesper,

On Wed, 15 Sep 2021 00:40:01 -0700 (PDT)
Jesper Taxbøl <[email protected]> wrote:

> Hi,
> 
> I am very new to emscriptem and I have been struggeling with porting a 
> function from c++ to javascript.
> 
> I have created a public repo with my sample function, and I aim to 
> implement feedback into it.
> 
> https://github.com/taxfromdk/wasm-glm-nlohmann
> 
> My overall mission is that I have some vector mathematics, that I would 
> like to implement once and use on c++ and javascript platforms. I am using 
> GLM as the vector-math-backbone, and I am under the impression that json is 
> a good compromise for the languages involved. I have therefore chosen 
> nlohmann's json library.
> 

I prepared a fixed version here:

https://github.com/taxfromdk/wasm-glm-nlohmann/compare/master...shlomif:shlomif1?expand=1

hope  that helps.

> https://github.com/g-truc/glm
> https://github.com/nlohmann/json
> 
> From what I can read, one strategy to communicate between js and c++, is 
> using a shared memory buffer. I have therefore created an example function 
> that takes a string and length as input and does, deserilization, 
> computation and finally serialization to the same buffer before returning.
> 
> The c++ part works fine, but i tend to get stuck on how to create a .wasm 
> file I can use inside the javascript of a browser.
> 
> I am on Ubuntu 20.04, and since the apt-get version of emscriptem seems to 
> be ancient, I have based my sample on a docker container. 
> 
> emscripten/emsdk
> 
> I have given it a shot by following 
> 
> https://wasmbyexample.dev/examples/strings/strings.c.en-us.html
> 
> The guide seems to be somewhat outdated, and my attempts crumble as soon as 
> I include my json library I intend to use. So I suspect I need to deal with 
> some bindings between the json library and system. My docker instance does 
> unfortunately not contain the tool wasm-objdump, which I suspect is needed 
> to dig into said dependencies.
> 
> That was a long intro, so thanx for having it made through it.
> 
> I am seeking some pointers on how I would go from here.
> 
> I hope to implement the advice in the repo for others to learn from.
> 
> Kind regards
> 
> Jesper
> 
> 



-- 

Shlomi Fish       https://www.shlomifish.org/
“So, who the hell is Qoheleth?” - https://shlom.in/qoheleth

The KGB used to torture their victims by having them look at scrolling XSLT
code.
    — https://www.shlomifish.org/humour/bits/facts/XSLT/

Please reply to list if it's a mailing list post - https://shlom.in/reply .

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/20210915124124.1e0ef52b%40telaviv.shlomifish.org.

Reply via email to