digitalmars.D - Playing with Visual D's new mixed solution support
- Mike Parker (27/27) Mar 19 2017 Every few years I do a little test to see how much effort it
- Adam Wilson (27/52) Mar 19 2017 I personally believe that this may end up being the breakout feature of
- WebFreak001 (4/12) Mar 19 2017 I will see what I can do with code-d, maybe in the future. I
- Rainer Schuetze (6/31) Mar 20 2017 Thanks for the report, Mike.
Every few years I do a little test to see how much effort it takes to get the ioquake3 [1] codebase set up in a way that I can replace bits of it with D implementations and compile it all together. Not because I plan to port the whole thing, but I'm perennially curious how difficult it would be for someone to get started on porting a complex C project to D piece by piece (the way it should be done). I have to say, Rainer has made it easier than ever on Windows with the new Visual D release [2]. So I generated a VS 2015 solution with the ioq3-premake-msvc project [3], loaded it up, compiled it all to make sure it works (ioq3 will find the Quake3 resources automatically if you have Quake3 installed via Steam). Then I added a D file, picked a function to reimplement in D, and built it again. This resulted in a handful of linker errors because the runtime isn't linked in automatically. Once I opened up the project properties and added the path to dmd2/windows/lib32mscoff to the linker directories and phobosm32mscoff.lib to the linker input, I had an instance of Quake3 running with a D implementation of Sys_Milliseconds [4]. As easy as that. No writing up custom build scripts, no manually adding D object files to the ioq3 project, or any of the other approaches I've taken in the past. Awesome! I think I'll do a write up on this for the D blog in the near future. Great job, Rainer! [1] https://ioquake3.org/ [2] http://forum.dlang.org/thread/oa3dp7$icu$1 digitalmars.com [3] https://github.com/jpcy/ioq3-premake-msvc [4] http://i.imgur.com/VP0ibfH.png
Mar 19 2017
On 3/19/17 5:16 AM, Mike Parker wrote:Every few years I do a little test to see how much effort it takes to get the ioquake3 [1] codebase set up in a way that I can replace bits of it with D implementations and compile it all together. Not because I plan to port the whole thing, but I'm perennially curious how difficult it would be for someone to get started on porting a complex C project to D piece by piece (the way it should be done). I have to say, Rainer has made it easier than ever on Windows with the new Visual D release [2]. So I generated a VS 2015 solution with the ioq3-premake-msvc project [3], loaded it up, compiled it all to make sure it works (ioq3 will find the Quake3 resources automatically if you have Quake3 installed via Steam). Then I added a D file, picked a function to reimplement in D, and built it again. This resulted in a handful of linker errors because the runtime isn't linked in automatically. Once I opened up the project properties and added the path to dmd2/windows/lib32mscoff to the linker directories and phobosm32mscoff.lib to the linker input, I had an instance of Quake3 running with a D implementation of Sys_Milliseconds [4]. As easy as that. No writing up custom build scripts, no manually adding D object files to the ioq3 project, or any of the other approaches I've taken in the past. Awesome! I think I'll do a write up on this for the D blog in the near future. Great job, Rainer! [1] https://ioquake3.org/ [2] http://forum.dlang.org/thread/oa3dp7$icu$1 digitalmars.com [3] https://github.com/jpcy/ioq3-premake-msvc [4] http://i.imgur.com/VP0ibfH.pngI personally believe that this may end up being the breakout feature of D. The ability to seamlessly inter-operate with other languages will be a powerful, real-world, visual of what D can do a professional environment. I think that we sometimes forget that engineering software is multi-disciplinary activity that extends far beyond the confines of good languages. We often get into holy-wars here on the forums about this-or-that broken language construct. But we often forget what drove us here. I mean, would you like me to break out the list of out-right brokeness that is C++? Actually, I think Scott Myers (whose talk I am impatiently waiting for at DConf this year) does a better job than I ever could: https://www.youtube.com/watch?v=48kP_Ssg2eY And C++ is considered a professional language. I would argue that D is no worse quality wise then C++/ This project is an excellent first step, but it only works with Windows/Visual Studio. We need to follow up with build support across platforms. For example, VSCode has a C++ plugin, is there any way the Code-D plugin could inter-operate with that as VisualD does? That would get us cross-platform editor support. Could DUB be improved to support C++? Do other build tools exist that already allow this type of interop? I am asking these questions because I don't know. I personally use D without C/C++ interop so I've never encountered these problems, but these are the types of questions that we will need to answer. -- Adam Wilson IRC: LightBender import quiet.dlang.dev;
Mar 19 2017
On Sunday, 19 March 2017 at 19:58:16 UTC, Adam Wilson wrote:For example, VSCode has a C++ plugin, is there any way the Code-D plugin could inter-operate with that as VisualD does? That would get us cross-platform editor support. Could DUB be improved to support C++? Do other build tools exist that already allow this type of interop? I am asking these questions because I don't know. I personally use D without C/C++ interop so I've never encountered these problems, but these are the types of questions that we will need to answer.I will see what I can do with code-d, maybe in the future. I would first need to try mixed support with C++ out before I can implement it
Mar 19 2017
On 19.03.2017 13:16, Mike Parker wrote:Every few years I do a little test to see how much effort it takes to get the ioquake3 [1] codebase set up in a way that I can replace bits of it with D implementations and compile it all together. Not because I plan to port the whole thing, but I'm perennially curious how difficult it would be for someone to get started on porting a complex C project to D piece by piece (the way it should be done). I have to say, Rainer has made it easier than ever on Windows with the new Visual D release [2]. So I generated a VS 2015 solution with the ioq3-premake-msvc project [3], loaded it up, compiled it all to make sure it works (ioq3 will find the Quake3 resources automatically if you have Quake3 installed via Steam). Then I added a D file, picked a function to reimplement in D, and built it again. This resulted in a handful of linker errors because the runtime isn't linked in automatically. Once I opened up the project properties and added the path to dmd2/windows/lib32mscoff to the linker directories and phobosm32mscoff.lib to the linker input, I had an instance of Quake3 running with a D implementation of Sys_Milliseconds [4]. As easy as that. No writing up custom build scripts, no manually adding D object files to the ioq3 project, or any of the other approaches I've taken in the past. Awesome! I think I'll do a write up on this for the D blog in the near future. Great job, Rainer! [1] https://ioquake3.org/ [2] http://forum.dlang.org/thread/oa3dp7$icu$1 digitalmars.com [3] https://github.com/jpcy/ioq3-premake-msvc [4] http://i.imgur.com/VP0ibfH.pngThanks for the report, Mike. Having to add the phobos library and the search path should only be necessary, if the D files are added to a static library project, and none is added to the project that actually links the binary. I hope that this was the case for Quake, but your screen shot suggests otherwise.
Mar 20 2017