Re: How can I use class and wasm?

2020-10-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 26 October 2020 at 21:38:39 UTC, Jack wrote: I did consider do something like this but the class would only live in the function's lifetime, right? that wouldn't work if I need to pass the class around Right, you'd have to manage the memory somehow. One possibility is to malloc it

Re: How can I use class and wasm?

2020-10-26 Thread Jack via Digitalmars-d-learn
On Friday, 16 October 2020 at 03:42:22 UTC, Adam D. Ruppe wrote: On Friday, 16 October 2020 at 03:04:25 UTC, Jack wrote: How can I allocate memory for this class? It is possible but not easy without druntime. If you are using -betterC, you can use extern(C++) classes with extern(D) members.

Re: How can I use class and wasm?

2020-10-15 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 16 October 2020 at 03:04:25 UTC, Jack wrote: How can I allocate memory for this class? It is possible but not easy without druntime. If you are using -betterC, you can use extern(C++) classes with extern(D) members. The compiler will let you declare that. But then you need to allo

Re: How can I use class and wasm?

2020-10-15 Thread Jack via Digitalmars-d-learn
On Friday, 16 October 2020 at 02:43:19 UTC, Paul Backus wrote: On Thursday, 15 October 2020 at 22:02:11 UTC, Jack wrote: can I make it work? the code (see below) result in link error: lld: error: wasm.o: undefined symbol: _D4wasm1C7__ClassZ lld: error: wasm.o: undefined symbol: _d_allocclass E

Re: How can I use class and wasm?

2020-10-15 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 15 October 2020 at 22:02:11 UTC, Jack wrote: can I make it work? the code (see below) result in link error: lld: error: wasm.o: undefined symbol: _D4wasm1C7__ClassZ lld: error: wasm.o: undefined symbol: _d_allocclass Error: linking with LLD failed command line: ldc2 --d-debug -m

How can I use class and wasm?

2020-10-15 Thread Jack via Digitalmars-d-learn
can I make it work? the code (see below) result in link error: lld: error: wasm.o: undefined symbol: _D4wasm1C7__ClassZ lld: error: wasm.o: undefined symbol: _d_allocclass Error: linking with LLD failed command line: ldc2 --d-debug -mtriple=wasm32-unknown-unknown-wasm -betterC wasm.d ldc v