how do i fix this node_dlang error?

Jack jckj33 at gmail.com
Mon Jun 7 22:30:04 UTC 2021


On Monday, 7 June 2021 at 20:37:19 UTC, MoonlightSentinel wrote:
> On Monday, 7 June 2021 at 19:03:44 UTC, Jack wrote:
>> actually i didnt so I just added:
>>
>> ```d
>> shared static this()
>> {
>> 	Runtime.initialize();
>> }
>>
>> shared static ~this()
>> {
>> 	Runtime.terminate();
>> }
>> ```
>>
>> but it didn't change anything
>
> That doesn't work because `Runtime.initialize()` is responsible 
> to execute the module ctors. You could try 
> `pragma(crt_constructor)`[1] instead.
>
> [1] https://dlang.org/spec/pragma.html#crtctor

I see, thanks for pointing out. I think the entry point function 
is the one set by MainFunction in the exportToJs template so I 
guess there's no need to this or DllMain.  the 
[example](https://github.com/NotSpooky/node_dlang/blob/master/examples/type_examples/source/example.d) from the node_dlang have no other entry function than the defined by MainFunction template


More information about the Digitalmars-d-learn mailing list