I'm trying the static bindings for glfw of bindbc on Windows, using the pre-compiled .lib files from the lib-vc2015 folder in the official download. (http://code.dlang.org/packages/bindbc-glfw) With LDC using the Microsoft MSCV linker, everything works. I can either add this:

app.d:
```
version(X86)    pragma(lib, "lib32/glfw3.lib");
version(X86_64) pragma(lib, "lib64/glfw3.lib");
```

Or this:

dub.sdl:
```
libs "lib32/glfw3" platform="windows-x86"
libs "lib64/glfw3" platform="windows-x86-64"
```

And then these:
dub --arch=x86 --compiler=ldc2
dub --arch=x86_64 --compiler=ldc2

Both work, albeit with a lot of warnings:
libcmt.lib(initializers.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library glfw3.lib(init.c.obj) : warning LNK4217: locally defined symbol ___stdio_common_vsprintf imported in function __glfwInputError glfw3.lib(wgl_context.c.obj) : warning LNK4049: locally defined symbol _calloc imported

I omitted about 30 more LNK4049 warnings.
With --link-internally, I get the same warnings. It finishes linking, but running results in a "Program exited with code -1073741819".

With dmd, I have less luck. First of all, I have to use --arch=x86_mscoff, or else it uses OPTLINK for 32-bit which only handles OMF, though ldc says "Unsupported architecture: x86_mscoff" when I do that, which is inconsistent.

But that's just a minor annoyance, the error is that there are 82 unresolved externals.

glfw3.lib(win32_init.c.obj) : error LNK2019: unresolved external symbol __imp__RegisterDeviceNotificationW@12 referenced in function _createHelperWindow glfw3.lib(win32_init.c.obj) : error LNK2019: unresolved external symbol __imp__CreateWindowExW@48 referenced in function _createHelperWindow
...

I think dmd uses the same linker as LDC, but I don't know how to tell for sure.

I mentioned a lot of issues in this post, but I'll be happy if I can compile it with dmd. Making it work with lld and removing the warnings are also nice, but I can live with Microsoft's linker and some command line clutter. Any help will be appreciated.

Reply via email to