how do i fix this node_dlang error?

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


On Monday, 7 June 2021 at 20:13:03 UTC, frame wrote:
> On Monday, 7 June 2021 at 02:33:38 UTC, Jack wrote:
>
>> What am I missing?
>
> If this runs under Windows, there is no dlopen(), maybe a 
> wrapper to LoadLibrary() but this will need to call a DllMain() 
> in the DLL if I am not wrong. Is there a DllMain?

I just noticied that's supposed to have a DllMain even tho the 
[code 
example](https://github.com/NotSpooky/node_dlang/blob/master/examples/type_examples/source/example.d) from node_dlang doesn't have one and it was working(?) I added one in my code but it give same error. I added like this:

```d
module foo;

import std.stdio : stderr;
import node_dlang;
import core.sys.windows.windows;
import core.sys.windows.dll;

mixin SimpleDllMain;

extern(C):

     void atStart(napi_env env)
     {
         import std.stdio;
       	writeln (`Loaded D native library!`);
     }

     int ultimate()
     {
     	return 43;
     }

mixin exportToJs! (ultimate, MainFunction!atStart);
```


More information about the Digitalmars-d-learn mailing list