Linking with a c library on windows with ldc

maik klein via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Fri Apr 1 03:28:45 PDT 2016


I just wanted to build my project on windows, but it turned out 
to be much harder than I thought. In DMD there is some legacy 
stuff with 32bit apps but I mostly ignored it because I want to 
ouput 64 bit binaries anways. The problem is dmd always return an 
ICE if want to generate a 64bit binary.

So I thought I would give ldc a try.

The first problem was with dub, as currently it still outputs a 
'.a' lib on windows, so I had to fix that.

I am currently linking with glfw on linux like this

dependency "derelict-glfw3" version="~>2.0.0"
subConfiguration "derelict-glfw3" "derelict-glfw3-static"
sourceFiles "deps/linux64/libglfw3.a"
libs "Xi" "pthread" "X11" "Xxf86vm" "Xrandr" "pthread" "GL" "GLU" 
"Xinerama" "Xcursor"

This is how I did it on windows

dependency "derelict-glfw3" version="~>2.0.0"
subConfiguration "derelict-glfw3" "derelict-glfw3-static"
sourceFiles "deps/win64/libglfw3.lib"
libs "opengl32"

I just installed vs2013 and vcredist2013 and vsredist2015 on 
windows 7.

First I got a linker error that it couldn't find opengl32, so I 
temporarily removed it.

Then I got a linker error with legacy_stdio. I made a quick 
google search and I found an issue for ldc. Apparently I had to 
remove a line from  ldc2.ini to make it work with vs2013.

But there was nothing related to legacy_stdio inside this .ini so 
I removed vs2013 and installed vs2015.

But I get an error with vs2015 for both dmd and ldc.

So my question:

What do I need to install? Have I done anything wrong? Are there 
any docs that can help me?


More information about the digitalmars-d-ldc mailing list