www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Building a wasm library, need to override .object._d_newitemT!T

reply Etienne Cimon <etienne cimons.com> writes:
Hello,

I've been developing a library[1] based on spasm for which I've 
implemented the druntime and currently it compiles web apps 
properly with TypeInfo, no GC, and it even uses diet templates.

I'm having a problem implementing the `new` keyword, so that I 
can start importing more libraries with minimal change. However, 
LDC calls .object._d_newitemT!T from the original druntime - 
which I need for compile-time function execution, but my 
implementation in `module object` doesn't override it in the 
compiler and the original implementation tries import 
core.stdc.time which errors out in wasm (with good reasons). Is 
there a compiler flag than I can use to override module templates?

Thanks in advance.

[1] https://github.com/etcimon/libwasm
Dec 23 2023
parent reply Johan <j j.nl> writes:
On Saturday, 23 December 2023 at 20:42:37 UTC, Etienne Cimon 
wrote:
 
 I'm having a problem implementing the `new` keyword, so that I 
 can start importing more libraries with minimal change. 
 However, LDC calls .object._d_newitemT!T from the original 
 druntime - which I need for compile-time function execution, 
 but my implementation in `module object` doesn't override it in 
 the compiler and the original implementation tries import 
 core.stdc.time which errors out in wasm (with good reasons). Is 
 there a compiler flag than I can use to override module 
 templates?
_d_newitemT!T is fairly new, what compiler version are you using? -Johan
Dec 24 2023
parent Etienne <etcimon gmail.com> writes:
On Sunday, 24 December 2023 at 10:50:41 UTC, Johan wrote:
 _d_newitemT!T is fairly new, what compiler version are you 
 using?

 -Johan
Nevermind, I managed to get it working but I had to compile without including druntime and phobos and move everything into the library. I'm using ldc 1.36.0-beta1
Dec 24 2023