How can I use class and wasm?

Paul Backus snarwin at gmail.com
Fri Oct 16 02:43:19 UTC 2020


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 
>>wasm.d
>
> 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() {}
>>
>>extern(C)
>>int g()
>>{
>>    auto c = new C();

You can't use `new` in betterC.


More information about the Digitalmars-d-learn mailing list