I'm trying to use the node_dlang pakckage but the code example from this repo isn't working
the command dub build
is fine but node example.js
retuns an error saying the module.node is not a valid win32 application. How do I fix this?
Thread overview | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
June 06, 2021 how do i fix this node_dlang error? | ||||
---|---|---|---|---|
| ||||
I'm trying to use the node_dlang pakckage but the code example from this repo isn't working the command |
June 06, 2021 Re: how do i fix this node_dlang error? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jack | On Sunday, 6 June 2021 at 04:25:39 UTC, Jack wrote: >I'm trying to use the node_dlang pakckage but the code example from this repo isn't working the command Looking at node_dlang's dub.json, it's building a DLL then renaming it to module.node. The JS script then causes node to load the DLL. So I expect this error may be related to a 32-bit vs. 64-bit issue. I assume you are on 64-bit Windows, in which case recent versions of dub compile as 64-bit by default. So if that's the case, and your installation of node is 32-bit, you would see this error. Ditto when you're loading a 32-bit DLL in a 64-bit process. |
June 06, 2021 Re: how do i fix this node_dlang error? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Parker | On Sunday, 6 June 2021 at 06:10:18 UTC, Mike Parker wrote: >On Sunday, 6 June 2021 at 04:25:39 UTC, Jack wrote: >I'm trying to use the node_dlang pakckage but the code example from this repo isn't working the command Looking at node_dlang's dub.json, it's building a DLL then renaming it to module.node. The JS script then causes node to load the DLL. So I expect this error may be related to a 32-bit vs. 64-bit issue. I assume you are on 64-bit Windows, in which case recent versions of dub compile as 64-bit by default. So if that's the case, and your installation of node is 32-bit, you would see this error. Ditto when you're loading a 32-bit DLL in a 64-bit process. that's right, I was on 64bit system and node was 32bit installation (I didn't even realize I installed the 32bit instead of 64bit). I just installed node 64bit version, that fixed, thanks! |
June 06, 2021 Re: how do i fix this node_dlang error? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Parker | On Sunday, 6 June 2021 at 06:10:18 UTC, Mike Parker wrote: >On Sunday, 6 June 2021 at 04:25:39 UTC, Jack wrote: >I'm trying to use the node_dlang pakckage but the code example from this repo isn't working the command Looking at node_dlang's dub.json, it's building a DLL then renaming it to module.node. The JS script then causes node to load the DLL. So I expect this error may be related to a 32-bit vs. 64-bit issue. I assume you are on 64-bit Windows, in which case recent versions of dub compile as 64-bit by default. So if that's the case, and your installation of node is 32-bit, you would see this error. Ditto when you're loading a 32-bit DLL in a 64-bit process. the npm was 32bit so the switch to 64bit worked then npm example.js ran file but electron requires a 32bit module, so I need to switch back to npm 32bit. Now, I can't build the example from node_dlang with --arch=x86, returns the error: command:
output:
|
June 06, 2021 Re: how do i fix this node_dlang error? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jack | On Sunday, 6 June 2021 at 15:42:55 UTC, Jack wrote: C:\D\dmd2\windows\bin....\src\druntime\import\object.d(2440,30):
The error is from line 137 of node_dlang.d. Looking at it, we see this:
This is in the constructor of the Looking closer, we can see that the arguments to the super constructor are all declared in the
Compare that with the constructors in the The
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 |
June 06, 2021 Re: how do i fix this node_dlang error? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jack | On Sunday, 6 June 2021 at 04:25:39 UTC, Jack wrote: >I'm trying to use the node_dlang pakckage but the code example from this repo isn't working the command Hello, I'm the author of the library. Aside from the auto-translated headers, in the case of Windows the repo also includes node.lib compiled for 64-bit, so unless the 32-bit version is added it will also give errors. I'm pretty sure it does work with electron as I have used it myself. |
June 07, 2021 Re: how do i fix this node_dlang error? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Parker | 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: [...] The error is from line 137 of node_dlang.d. Looking at it, we see this:
This is in the constructor of the Looking closer, we can see that the arguments to the super constructor are all declared in the
Compare that with the constructors in the The
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 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 |
June 07, 2021 Re: how do i fix this node_dlang error? | ||||
---|---|---|---|---|
| ||||
Posted in reply to NotSpooky | On Sunday, 6 June 2021 at 21:44:44 UTC, NotSpooky wrote: >On Sunday, 6 June 2021 at 04:25:39 UTC, Jack wrote: >I'm trying to use the node_dlang pakckage but the code example from this repo isn't working the command Hello, I'm the author of the library. nice works, thanks for the library! >Indeed I only tested it on 64-bit systems. I can try to make it 32-bit compatible if needed. for me i think it would be needed, i made everything 64bit so it at least compiled and ran. >Aside from the auto-translated headers, in the case of Windows the repo also includes node.lib compiled for 64-bit, so unless the 32-bit version is added it will also give errors. I'm pretty sure it does work with electron as I have used it myself. I managed to compile the module and it passed this test:
The D code looks like this:
its builds sucessfully with
then i test with node:
it works fine. However, when I attempt to use it in the prescript within electron, I get this error:
What am I missing? |
June 07, 2021 Re: how do i fix this node_dlang error? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jack | On Monday, 7 June 2021 at 02:33:38 UTC, Jack wrote: >What am I missing? Does your code / |
June 07, 2021 Re: how do i fix this node_dlang error? | ||||
---|---|---|---|---|
| ||||
Posted in reply to MoonlightSentinel | On Monday, 7 June 2021 at 17:22:48 UTC, MoonlightSentinel wrote: >On Monday, 7 June 2021 at 02:33:38 UTC, Jack wrote: >What am I missing? Does your code / actually i didnt so I just added:
but it didn't change anything >Try replacing the I've tried just removed the writeln() call it didn't change anything either |