January 06, 2012
On Friday, 6 January 2012 at 20:03:01 UTC, Adam Wilson wrote:
> On Fri, 06 Jan 2012 10:27:58 -0800, Manu <turkeyman@gmail.com> wrote:
>
>> Okay, so I was trying to link to a C lib, and I realised... DMD doesn't
>> support/produce VS compatible libs.
>> I should have realised this sooner, noting the cv debuginfo.
>>
>> So like... WTF?
>>
>> How am I supposed to use DMD in Windows in anything other than trivial,
>> self-contained programs?
>> VisualC is the de facto standard in Windows. All libs are COFF, and (unless
>> I'm working with GCC) everything I want to link to is produced from VC.
>>
>> Let's also mention the debug info... Virtually every 3rd party tool assumes
>> and/or works best with PDB debug info. Being required to run cv2pdb is
>> pretty lame.
>>
>> So... why no support for COFF libs, and PDB debug info?
>> Surely at least a compiler option would do the business if there is some
>> kinky attachment to CV and OMF :/
>>
>> I was hoping to start a project using D as a front end language interacting
>> with my C/C++ engine lib... but I can't.
>> ... and now that I think if it... how do ANY programs built with DMD
>> actually work? .. How does it link to system32.lib, user32.lib, etc?
>
> DMD on Linux gets ELF with x64 support.
> DMD on OSX gets Mach-O with x64 support.
> DMD on Windows gets ... OMF with no x64 support.
>
> COFF is an absolute requirements when working on Windows, yet DMD doesn't support it. Everything, every programming interface, every application running on x64 Windows is built with COFF, the default output of every other compiler on Windows is COFF, everyone else programming on Windows is expecting COFF.
> Windows represents the largest OS install base in the world; and yet, Windows based D programmers are told that they have to dig up extremely esoteric tools from the darkest, smelliest, most cobwebbed corners of the Internet, just to be able to interact with the the rest of the Windows world.
>
> This situation is simply unacceptable.
>
> Everything else on Windows is COFF, if DMD ever wants to be accepted as a mainstream Windows development tool, it simply *MUST* support COFF. And no amount of wishing will ever change this. Without COFF, D will ALWAYS be hamstrung on Windows, even if OMF ever got x64 support. Every other platform that DMD supports got their native object formats. It is now time to get the native Windows format in D.
>
> All DMD needs to do is output the COFF files, any number of linkers available on Windows can handle it from there. It doesn't have to replace OMF and it doesn't even have to be the default option, but it absolutely MUST be AN option.

I'm not a Windows user myself, but I completely agree. I'm writing a game engine and I'd like to do it in D at some point. However, I also have to support Windows and the other platforms (I develop on FreeBSD and support Windows,Linux,Mac,FreeBSD) and OMF is a blocker. I'm really glad DMD now supports ELF shared libs though. It basically solves one half of my problems.
January 06, 2012
"Trass3r" <un@known.com> wrote in message news:op.v7ofwpwh3ncmek@enigma...
>> The problem: On windows, DMD uses the Optlink linker. Optlink only
>> supports OMF right now (OMF used to be commonly used by Borland, IIRC).
>> Optlink was written entirely in asm so changing it is difficult. But
>> Walter has been,
>> piece-by-piece, porting it to C (and then he'll port it to D).
>
> I say get rid of that freakin' dinosaur. Pull requests are already piling up, we can't afford losing more time.
>

I can't say I disagree :/  (So who's up for adding COFF support to DMD?)

>> (This is issue also happens to be the main thing blocking 64-bit on Windows.)
>
> Not quite true. You need 64Bit: object format, linker, librarian, debug info, compiler.
>

Well, ok, *one of* the main things ;)

>> - Recompile the libs using DMC (the Digital Mars C/C++ compiler). That will result in an OMF lib file that can be used with DMD.
>
> Did you ever try that?? You can't even mention that, let alone recommend it.
>

Depends on the lib really. DMC is a perfectly capable compiler as far as I can tell. It's just that some projects have fairly complex buildscripts that are fairly hardwired for MSVC and/or GCC. Anything with a sane buildsystem should be fine (though how common that is in C/C++-world, I can't say...).


>> - Use the Digital Mars COFF2OMF tool to convert to lib to OMF. Unfortunately, the tool isn't free, but IIRC it's inexpensive.
>
> Doesn't matter. You already have to pay enough by having to deal with that OMF crap.
>

Regardless, it *is* an option, so I listed it. I leave it up to others to decide if it's right for them.

>> If you feel this is all still a big pain in the ass: Don't worry, everyone here agrees with you, and the situation will not remain like this forever.
>
> I'm sceptical.


January 06, 2012
"Manu" <turkeyman@gmail.com> wrote in message news:mailman.126.1325877634.16222.digitalmars-d@puremagic.com...
>
> Lame. Surely Optlink is not the only linker in the world...?
> I'm also surprised that someone capable of writing a compiler and
> optimiser
> for a complex language isn't capable of writing a linker. The link must
> surely be the simplest+easiest of those 3 jobs...?

He (ie, Walter) *did* write Optlink, that's why DMD/Win uses it :/

(And OMF wasn't such a problem back when Optlink was written. AIUI, not being an expert in the matter myself, the decline of Borland seems to be one of the main reasons for OMF's demise.)

>Why not use this instead of Optlink if it works?
>I'll check it out... though VisualD doesn't support this.
...
> VisualD doesn't support those compilers (yet).
>

Yea, GDC and LDC were lagging pretty far behind until only fairly recently, and we didn't discover unilink until not real long ago either, so D many projects have been slow in supporting them. But yea, as a community we probably do need to make sure to start supporting them better.

>> If you feel this is all still a big pain in the ass: Don't worry,
>> everyone
>> here agrees with you, and the situation will not remain like this
>> forever.
>
> Indeed. The main reason for my post is just to complain, and add my voice
> ;)
> I'd like to insist that this is basically unacceptable... it should be
> prioritised.
>

vote++


January 06, 2012
"Adam Wilson" <flyboynw@gmail.com> wrote in message news:op.v7ohzbof707hn8@apollo.hra.local...
>
> All DMD needs to do is output the COFF files, any number of linkers available on Windows can handle it from there. It doesn't have to replace OMF and it doesn't even have to be the default option, but it absolutely MUST be AN option.
>

Just thinking: Since DigitalMars already has an OMF2COFF tool, would it really be all that hard for someone with access to and knowledge of the source (ie, Walter ;) ) to adapt it, or the knowledge within it, into a COFF output module for DMD? (Or has that been the plan all along?)


January 06, 2012
Trass3r wrote:
> 2) use GDC, then you also get 64Bit:

wait... I was under the impression GDC and LDC can't build 64bit apps for Windows. Or are you talking about the compiler executing/linking in 64bit?


Manu wrote:
> > - Use LDC or GDC instead of DMD. I think those work with COFF.
> >
> 
> VisualD doesn't support those compilers (yet).

I'm not sure if Mono-D supports GDC/LDC but, as a Visual Studios user myself, I recommend using Mono-D for D development on any platform (at this time at least) because of it's Code-completion and Renaming features. I've even converted the Obsidian syntax theme over if you're interested. Although Mono's syntax highlighting is inferior to VS in many ways (no operator or user types distinction) at least in v2.8.5.
http://mono-d.sourceforge.net/


January 06, 2012
On Friday, 6 January 2012 at 20:45:11 UTC, F i L wrote:
> wait... I was under the impression GDC and LDC can't build 64bit apps for Windows.

I thought so. Haven't tried it though cause I'm on Linux now.

> I recommend using Mono-D for D development

DDT is also shaping up nicely.
January 06, 2012
On 06-01-2012 20:06, Nick Sabalausky wrote:
> "Manu"<turkeyman@gmail.com>  wrote in message
> news:mailman.118.1325874486.16222.digitalmars-d@puremagic.com...
>> Okay, so I was trying to link to a C lib, and I realised... DMD doesn't
>> support/produce VS compatible libs.
>> I should have realised this sooner, noting the cv debuginfo.
>>
>> So like... WTF?
>>
>> How am I supposed to use DMD in Windows in anything other than trivial,
>> self-contained programs?
>> VisualC is the de facto standard in Windows. All libs are COFF, and
>> (unless
>> I'm working with GCC) everything I want to link to is produced from VC.
>>
>> Let's also mention the debug info... Virtually every 3rd party tool
>> assumes
>> and/or works best with PDB debug info. Being required to run cv2pdb is
>> pretty lame.
>>
>> So... why no support for COFF libs, and PDB debug info?
>> Surely at least a compiler option would do the business if there is some
>> kinky attachment to CV and OMF :/
>>
>> I was hoping to start a project using D as a front end language
>> interacting
>> with my C/C++ engine lib... but I can't.
>> ... and now that I think if it... how do ANY programs built with DMD
>> actually work? .. How does it link to system32.lib, user32.lib, etc?
>>
>
> Yea, OMF is actually #1 PITA on Windows right now, unfortunately.
>
> The problem: On windows, DMD uses the Optlink linker. Optlink only supports
> OMF right now (OMF used to be commonly used by Borland, IIRC). Optlink was
> written entirely in asm so changing it is difficult. But Walter has been,
> piece-by-piece, porting it to C (and then he'll port it to D). (This is
> issue also happens to be the main thing blocking 64-bit on Windows.)
>
> There are a few solutions right now (in no particular order):
>
> - Recompile the libs using DMC (the Digital Mars C/C++ compiler). That will
> result in an OMF lib file that can be used with DMD.
>
> - Link with Unilink instead of DMD/Optlink. Unilink can link both OMF and
> COFF together just fine. I don't have a link offhand, and it's a little
> funky to learn how to use since the docs aren't very good, but I'm sure
> someone here will chime in (or you can search the archives, I know comeone
> posted a good introduction to it not too long ago).
>
> - Use the Digital Mars COFF2OMF tool to convert to lib to OMF.
> Unfortunately, the tool isn't free, but IIRC it's inexpensive.

There is the free objconv tool: http://www.agner.org/optimize/

>
> - Use LDC or GDC instead of DMD. I think those work with COFF.
>
> - If the library comes in a DLL version, you can download the free IMPLIB
> tool and use it to generate an OMF import library directly from the DLL
> (it'll still actually link to the DLL at runtime).
>
> - Search/Ask around: Someone may have already created an OMF version of the
> lib.
>
> The IMPLIB and COFF2OMF tools are here:
> http://www.digitalmars.com/download/freecompiler.html  IMPLIB is in the free
> "Basic Utilities" package, and COFF2OMF is in the "Extended Utilities
> Package"
>
> If you feel this is all still a big pain in the ass: Don't worry, everyone
> here agrees with you, and the situation will not remain like this forever.
>
>


-- 
- Alex
January 06, 2012
On 6 January 2012 22:45, F i L <witte2008@gmail.com> wrote:

> Manu wrote:
>
>> > - Use LDC or GDC instead of DMD. I think those work with COFF.
>> >
>>
>> VisualD doesn't support those compilers (yet).
>>
>
> I'm not sure if Mono-D supports GDC/LDC but, as a Visual Studios user myself, I recommend using Mono-D for D development on any platform (at this time at least) because of it's Code-completion and Renaming features. I've even converted the Obsidian syntax theme over if you're interested. Although Mono's syntax highlighting is inferior to VS in many ways (no operator or user types distinction) at least in v2.8.5. http://mono-d.sourceforge.net/


Nice, is the author of this someone in this community? I wonder if they could contribute some of that effort towards VisualD... for some reason VisualD lacks heaps of these features.

Monodevelop is surprisingly usable... although sadly, for me, my build
system uses premake to generate VisualStudio projects (and makefiles/etc on
other platforms).
I hope VisualD is given a lot more love and made awesome. But this might be
a nice option in the mean time... with manual project configuration.

I think VisualD is extremely important. It's fundamental to mainstream adoption of D. Most windows programmers will simply not consider the language until it is well supported in Visual Studio (and that's a LOT of programmers, including basically the entire game dev community... [all console SDK's are Windows+VisualStudio based])

I certainly wouldn't be using D now if VisualD didn't exist...


January 07, 2012
Trass3r wrote:
> DDT is also shaping up nicely.

Haven't tried it yet. Does it have context sensitive code-completion? Honestly I would love to use Geany because it's so clean and light-weight, but it just doesn't support enough productivity features yet.




Manu wrote:
> Monodevelop is surprisingly usable... although sadly, for me, my build
> system uses premake to generate VisualStudio projects (and makefiles/etc on
> other platforms).

MonoDevelop is compatible with VS2010 solution/project files. One of the best parts about MD is how seamlessly it works across all platforms. Really the best IDE on Linux and Mac IMO, but then again I haven't tried them all. Unfortunately Visual-D and Mono-D projects are incompatible. It would be great to see these two projects collaborate.


> ...including basically the entire game dev community... [all
> console SDK's are Windows+VisualStudio based])
>
> I certainly wouldn't be using D now if VisualD didn't exist...

Unity3D ships with MonoDevelop as it's primary code editor, and it's rather successful ;) I agree with what your saying here though. Power tools get the job done faster. After using proper code-completion and refactoring tools, it's hard to go back.


January 07, 2012
On 7 January 2012 02:37, F i L <witte2008@gmail.com> wrote:

> Manu wrote:
>
>> Monodevelop is surprisingly usable... although sadly, for me, my build
>> system uses premake to generate VisualStudio projects (and makefiles/etc
>> on
>> other platforms).
>>
>
> MonoDevelop is compatible with VS2010 solution/project files. One of the best parts about MD is how seamlessly it works across all platforms. Really the best IDE on Linux and Mac IMO, but then again I haven't tried them all. Unfortunately Visual-D and Mono-D projects are incompatible. It would be great to see these two projects collaborate.
>

Works with VS2010 projects? Bullllshiiii....! I had no idea. Finally! An IDE that's usable in Linux and OSX!! :)

I'll have to seriously try this out.. I haven't used monodevelop for about a year. How does it do with C/C++ now?

If monodevelop supports vs2010 projects, then it would be REALLY awesome of monodevelop and VisualD would agree to make their D project files compatible...