how do i fix this node_dlang error?

Jack jckj33 at gmail.com
Mon Jun 7 02:23:04 UTC 2021


On Sunday, 6 June 2021 at 17:32:57 UTC, Mike Parker wrote:
> On Sunday, 6 June 2021 at 15:42:55 UTC, Jack wrote:
> 0.4.11\node_dlang\source\node_dlang.d(137,11): Error: none of 
> the overloads of `this` are callable using argument types 
> `(string, string, ulong, Throwable)`, candidates are:
>> [...]
>
> The error is from line 137 of node_dlang.d. Looking at it, we 
> see this:
>
> ```d
> super (message, file, line, nextInChain);
> ```
>
> This is in the constructor of the `JSException` class, a 
> subclass of `Exception`, calling the superclass constructor. 
> According to the error message, one or more of the arguments in 
> this list does not match any `Exception` constructor's 
> parameter list.
>
> Looking closer, we can see that the arguments to the super 
> constructor are all declared in the `JSException` constructor 
> like this:
>
> ```d
> this (
>     napi_value jsException
>     , string message = `JS Exception`
>     , string file = __FILE__
>     , ulong line = cast (ulong) __LINE__
>     , Throwable nextInChain = null)
> ```
>
> Compare that with the constructors in the `Exception` class and 
> you should see that the problem is `ulong line`. The equivalent 
> argument in the superclass is `size_t`. In 32-bit, `size_t` is 
> defined as `uint`, not `ulong`. So it's passing a `ulong` to a 
> `uint`, which is a no-no.
>
> The `JSException` constructor should be modified to this:
>
> ```d
> , size_t line = __LINE__
> ```

Thanks, I managed to get out this error by making everything 
64bit so no type sizes mismatch anymore. The electron itself was 
still 32bit, which was causing the error to load but it was gone 
once I reinstalled the 64version.

> The README does say it hasn't been tested with 32-bit. So there 
> may be more such errors.
>
> Unrelated, but I recommend you use `--arch=x86_mscoff`

thanks for the tip. in this case, i get the same error above not 
found the proper overload. But it's to avoid futher potential 
headaches, I'll edit the node_dlang.d file to make it work. 
Thanks!

> so that you can use the same linker and object file format as 
> `-m64` uses (MS link, or lld, and PE/COFF), rather than the 
> default (which is OPTLINK and OMF). It may save you further 
> potential headaches.



More information about the Digitalmars-d-learn mailing list