digitalmars.D.learn - Linking with/Debugging static C/C++ libraries
- Jeff Slutter (33/33) May 29 2011 I'm just starting out in my journey of R&D/evaluation of using D, as a
- Trass3r (19/29) May 30 2011 Good luck with that. DLLs are no problem but static libraries are anothe...
- Dmitry Olshansky (13/42) May 30 2011 It was me who brought it Unilink out of infernal abyss :) See also:
- Jeff Slutter (5/18) May 30 2011 I will give it a try.
- Dmitry Olshansky (9/27) May 30 2011 Yup, Borland's tools only.
I'm just starting out in my journey of R&D/evaluation of using D, as a possible future development platform, for my team at work. I like a lot of what I see! Currently we do all our development in Visual Studio, using C/C++ (and team. My goal is to reduce the learning curves, and new tools they'll have to pick up. The Visual D project is of great interest to me. One of the things that's important to us is being able to link against some existing C/C++ static libraries (built with VS 2008, so PE COFF format). In some light testing I was able to link a D2 project with a C/C++ Static library project in VS/VisualD with DMD. I had to use the objconv.exe tool, as the Digital Mars tool coff2omf.exe seems to be too old to work with the newer MS generated libraries. Unfortunately, it looks like objconv will always strip out debugging information, and while I had successful link and execution, I could only debug the D code, there was no debugging information for the C/C++ code. I suppose if the C/C++ code was in a DLL and D referenced the import lib, things would work much better, but there are some cases where our applications really need to come as a single executable and not have dependent DLLs along for the ride. Am I missing some sort of process or tool to make this all happen how I want? I want to be able to link C/C++ static libraries, generated with Visual Studio, with DMD, and maintain debugging information. Yes, I know, that is not a simple request. :) For what it's worth, using GDC and GCC/MingW (TDM), I was able to build and debug a D/C/C++ mixed executable. I had to use GDB (though WinGDB works just dandy), but the downside is I'm not using Visual D (unless Visual D supports GDC??), nor DMD. DMD seems that it would be more supported and stable right now than GDC, which seems to play catch up. I worry that, as a user of GDC, hitting a compiler bug, would take longer to get an official fix for, than it would for DMD. Thanks everyone... Jeff
May 29 2011
Am 30.05.2011, 04:09 Uhr, schrieb Jeff Slutter <MrMustard gmail.com>:One of the things that's important to us is being able to link against some existing C/C++ static libraries (built with VS 2008, so PE COFF format).Good luck with that. DLLs are no problem but static libraries are another story. objconv has never done the job for me. I'm surprised that it worked in your test. And compiling the code with dmc is a real PITA. Maybe dmd will finally switch to COFF output in the course of 64Bit transition but even then the 2 different compilers might generate incompatible code. There is a linker named Unilink though, which is reportedly able to link OMF and COFF files out of the box. But it doesn't even have a homepage, only an ftp server that's hard to find. Plus it's closed source so you can't assess whether it will continue to be developed, if it becomes commercial one day etc.For what it's worth, using GDC and GCC/MingW (TDM), I was able to build and debug a D/C/C++ mixed executable. I had to use GDB (though WinGDB works just dandy), but the downside is I'm not using Visual D (unless Visual D supports GDC??), nor DMD. DMD seems that it would be more supported and stable right now than GDC, which seems to play catch up. I worry that, as a user of GDC, hitting a compiler bug, would take longer to get an official fix for, than it would for DMD.GDC shares the frontend with dmd, so it will benefit from any FE bug fixed there. Regarding the glue code, it is currently maintained by Iain alone. He tends to be quite active though. OT: You are R&D and still use Windoze? ;)
May 30 2011
On 30.05.2011 16:57, Trass3r wrote:Am 30.05.2011, 04:09 Uhr, schrieb Jeff Slutter <MrMustard gmail.com>:It was me who brought it Unilink out of infernal abyss :) See also: http://www.digitalmars.com/d/archives/digitalmars/D/announce/Alternative_linker_win32_64_20086.html Seriously I still suggest to try it out, and at any rate author showed quite a motivation and provided full D support in no time. (there is little problem that he won't use CV debug symbols... and UniLink _converts_ them to Borland's TDS format) Still it's now possible to use any linker with VisualD, using 'compile only' option (in fact I just tried it out myself).One of the things that's important to us is being able to link against some existing C/C++ static libraries (built with VS 2008, so PE COFF format).Good luck with that. DLLs are no problem but static libraries are another story. objconv has never done the job for me. I'm surprised that it worked in your test. And compiling the code with dmc is a real PITA. Maybe dmd will finally switch to COFF output in the course of 64Bit transition but even then the 2 different compilers might generate incompatible code. There is a linker named Unilink though, which is reportedly able to link OMF and COFF files out of the box. But it doesn't even have a homepage, only an ftp server that's hard to find. Plus it's closed source so you can't assess whether it will continue to be developed, if it becomes commercial one day etc.Right and I've seen this cool option 'use other compiler' in recent VisualD with textbox for command line. So GDC & LDC support is almost there.For what it's worth, using GDC and GCC/MingW (TDM), I was able to build and debug a D/C/C++ mixed executable. I had to use GDB (though WinGDB works just dandy), but the downside is I'm not using Visual D (unless Visual D supports GDC??), nor DMD. DMD seems that it would be more supported and stable right now than GDC, which seems to play catch up. I worry that, as a user of GDC, hitting a compiler bug, would take longer to get an official fix for, than it would for DMD.GDC shares the frontend with dmd, so it will benefit from any FE bug fixed there. Regarding the glue code, it is currently maintained by Iain alone. He tends to be quite active though.OT: You are R&D and still use Windoze? ;)-- Dmitry Olshansky
May 30 2011
On 5/30/2011 10:57 AM, Dmitry Olshansky wrote:It was me who brought it Unilink out of infernal abyss :) See also: http://www.digitalmars.com/d/archives/digitalmars/D/announce/Alternative_linker_win32_64_20086.html Seriously I still suggest to try it out, and at any rate author showed quite a motivation and provided full D support in no time. (there is little problem that he won't use CV debug symbols... and UniLink _converts_ them to Borland's TDS format) Still it's now possible to use any linker with VisualD, using 'compile only' option (in fact I just tried it out myself).I will give it a try. With the Borland TDS debug symbols, that means no debugging with VisualD/Visual Studio right? (No CodeView, No PDB)Right and I've seen this cool option 'use other compiler' in recent VisualD with textbox for command line. So GDC & LDC support is almost there.I missed that, so that's exciting!
May 30 2011
On 30.05.2011 19:14, Jeff Slutter wrote:On 5/30/2011 10:57 AM, Dmitry Olshansky wrote:Yup, Borland's tools only. For the sake of expreiment I did tested it with latest trial of CodeGear C++ Builder-something long ago. I even thought to tweak Mago debugger so that it reads TDS symbols. IIRC it has dedicated component for symbol loading. But with GSOC I think my hands are full for the rest of summer :)It was me who brought it Unilink out of infernal abyss :) See also: http://www.digitalmars.com/d/archives/digitalmars/D/announce/Alternative_linker_win32_64_20086.html Seriously I still suggest to try it out, and at any rate author showed quite a motivation and provided full D support in no time. (there is little problem that he won't use CV debug symbols... and UniLink _converts_ them to Borland's TDS format) Still it's now possible to use any linker with VisualD, using 'compile only' option (in fact I just tried it out myself).I will give it a try. With the Borland TDS debug symbols, that means no debugging with VisualD/Visual Studio right? (No CodeView, No PDB)-- Dmitry OlshanskyRight and I've seen this cool option 'use other compiler' in recent VisualD with textbox for command line. So GDC& LDC support is almost there.I missed that, so that's exciting!
May 30 2011