www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Building Derelict based application under windows

reply ANtlord <antlord92 gmail.com> writes:
Hello! First of all I don't know what my problem is but please 
don't close the thread and give me a chance.

I have been working on DMD under Linux since I met D. Short time 
ago I got a reason to make an application for Windows. I took 
DerelictAL[1], DerelictOgg[2] and DerelictVorbis[3] implementing 
basic prototype under Linux. So everything ok under Linux. 
Unfortunately I get a couple of issue under Windows 7. The 
Windows is launched under VirtualBox.

The first one is target architecture the application is compiled 
for. I installed DMD 2.079 and Visual Studio 2015.2 so I 
corrected sc.ini consider the article[4] from the wiki. The file 
has the content that is available by the link [5]. But I'm not 
sure that dmd compiles code for 64 bit architecture because an 
address of any pointer consists of 6 symbols instead of 16. A 
pointer in C++ application consists of 16 symbols. There is D 
code [6].

The second one is warnings and errors during compilation of my 
application. Typical messages shows up inability of linker to 
recognize any direlict library so there are a couple of errors 
about unresolved symbols of direlict libraries. Full list of 
errors and warnings is available by the link [7].

Please help me to figure out how I can fix the issue. I don't 
want use another language to create the application.

My environment
Windows 7 64bit (under VirtualBox)
DMD 2.079
Visual Studio 2015.2

[1] https://github.com/DerelictOrg/DerelictAL
[2] https://github.com/DerelictOrg/DerelictVorbis
[3] https://github.com/DerelictOrg/DerelictOgg
[4] https://wiki.dlang.org/Installing_DMD
[5] 
https://gist.github.com/ANtlord/0c78180f627eb544cc69770ecbe997a7
[6] 
https://gist.github.com/ANtlord/e0a7e183498095b2f8a8726f35e63803
[7] 
https://gist.github.com/ANtlord/e8a0cc6f20b2b46124ae3cd72ed04bed

Thanks in advance. Please feel free to ask any question
Mar 22 2018
parent reply Mike Parker <aldacron gmail.com> writes:
On Thursday, 22 March 2018 at 20:51:36 UTC, ANtlord wrote:

 Thanks in advance. Please feel free to ask any question
Your errors with the derelict libs are linker errors, with the early ones being this one: "warning LNK4003: invalid library format; library ignored" At the top of the output, DUB is warning you that you've put -m64 in the package file and shouldn't do that. I would guess that's your problem. The libraries are being compiled as 32-bit OMF, which is default on the prepackaged DMD binaries on Windows, but the -m64 in your dflags is causing your app to compile as 64-bit. Try taking -m64 out of your package file and put -ax86_64 on your DUB command line instead.
Mar 22 2018
parent ANtlord <antlord92 gmail.com> writes:
On Friday, 23 March 2018 at 01:18:02 UTC, Mike Parker wrote:
 On Thursday, 22 March 2018 at 20:51:36 UTC, ANtlord wrote:

 Thanks in advance. Please feel free to ask any question
Your errors with the derelict libs are linker errors, with the early ones being this one: "warning LNK4003: invalid library format; library ignored" At the top of the output, DUB is warning you that you've put -m64 in the package file and shouldn't do that. I would guess that's your problem. The libraries are being compiled as 32-bit OMF, which is default on the prepackaged DMD binaries on Windows, but the -m64 in your dflags is causing your app to compile as 64-bit. Try taking -m64 out of your package file and put -ax86_64 on your DUB command line instead.
Thanks a lot. I tried it later but forgot to write about it to the forum. I fixed it adding --arch=x86_64 so a command for building is `dub build --arch=x86_64`
Mar 23 2018