How can I use class and wasm?

Jack jckj33 at
Fri Oct 16 03:04:25 UTC 2020

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
>>>Error: linking with LLD failed
>> command line:
>>>ldc2 --d-debug -mtriple=wasm32-unknown-unknown-wasm -betterC 
>> ldc version:
>>> 1.24.0-beta1 (DMD v2.094.0, LLVM 11.0.0)
>> code:
>>>extern(C): // disable D mangling
>>>// seems to be the required entry point
>>>void _start() {}
>>>int g()
>>>    auto c = new C();
> You can't use `new` in betterC.

that's right, my bad but even a custom allocator, using 
malloc()/free() wouldn't work either. How can I allocate memory 
for this class?

More information about the Digitalmars-d-learn mailing list