Jump to page: 1 28  
Page
Thread overview
DMD - Windows
Jan 06, 2012
Manu
Jan 06, 2012
Trass3r
Jan 06, 2012
F i L
Jan 06, 2012
Trass3r
Jan 06, 2012
Manu
Jan 07, 2012
F i L
Jan 07, 2012
Manu
Jan 07, 2012
Trass3r
Jan 07, 2012
Nick Sabalausky
Jan 07, 2012
Mail Mantis
Jan 07, 2012
Paulo Pinto
Jan 07, 2012
Manu
Jan 07, 2012
Paulo Pinto
Jan 07, 2012
Nick Sabalausky
Jan 07, 2012
Manu
Jan 08, 2012
Nick Sabalausky
Jan 08, 2012
Martin Nowak
Jan 08, 2012
Jim Hewes
Jan 09, 2012
Danni Coy
Jan 06, 2012
Nick Sabalausky
Jan 06, 2012
Trass3r
Jan 06, 2012
Nick Sabalausky
Jan 06, 2012
Manu
Jan 06, 2012
Adam D. Ruppe
Jan 06, 2012
Trass3r
Jan 06, 2012
Nick Sabalausky
Jan 07, 2012
Nick Sabalausky
Jan 06, 2012
Walter Bright
Jan 06, 2012
Trass3r
Jan 07, 2012
Walter Bright
Jan 07, 2012
Jacob Carlborg
Jan 07, 2012
Froglegs
Jan 07, 2012
Manu
Jan 08, 2012
Walter Bright
Jan 08, 2012
Walter Bright
Jan 08, 2012
Manu
Jan 08, 2012
Manu
Jan 08, 2012
Jacob Carlborg
Jan 08, 2012
Trass3r
Jan 08, 2012
Peter Alexander
Jan 08, 2012
Trass3r
Jan 08, 2012
Walter Bright
Jan 08, 2012
Trass3r
Jan 08, 2012
Walter Bright
Jan 08, 2012
Trass3r
Jan 09, 2012
Walter Bright
Jan 08, 2012
Walter Bright
Jan 08, 2012
q66
Jan 08, 2012
Martin Nowak
Jan 08, 2012
q66
Jan 08, 2012
Martin Nowak
Jan 08, 2012
Walter Bright
Jan 08, 2012
Walter Bright
Jan 08, 2012
Adam D. Ruppe
Jan 09, 2012
Walter Bright
Jan 09, 2012
Adam D. Ruppe
Jan 09, 2012
Martin Nowak
Jan 09, 2012
Adam D. Ruppe
Jan 09, 2012
Nick Sabalausky
Jan 09, 2012
Trass3r
Jan 09, 2012
Manu
Jan 09, 2012
Trass3r
Jan 09, 2012
Manu
Jan 09, 2012
Trass3r
Jan 08, 2012
Trass3r
Jan 08, 2012
Walter Bright
Jan 08, 2012
q66
Jan 08, 2012
Trass3r
Jan 06, 2012
Adam Wilson
Jan 06, 2012
q66
Jan 06, 2012
Nick Sabalausky
Jan 07, 2012
torhu
Jan 07, 2012
Adam Wilson
Jan 07, 2012
Manu
Jan 07, 2012
Don
Jan 07, 2012
Manu
January 06, 2012
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?


January 06, 2012
Am 06.01.2012, 19:27 Uhr, schrieb Manu <turkeyman@gmail.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?

Welcome to the jungle ^^

Your options are:
1) use dlls + implib, then you can work with MinGW or VisualC
2) use GDC, then you also get 64Bit: https://bitbucket.org/goshawk/gdc/downloads

*) torture yourself by trying to link statically with objconv
*) try UniLink


> 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.

pdb is undocumented. Even cv2pdb is based more or less on reverse engineering.


> ... 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?

Those system libs are just import libraries for the respective DLLs, even in VS.
January 06, 2012
"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.

- 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.


January 06, 2012
> 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.

> (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.

> - 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.

> - 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.

> 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
On 6 January 2012 21:06, Nick Sabalausky <a@a.a> wrote:

> 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.)
>

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...?


> 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.
>

DMx has inferior code generation, not a chance :) .. And does DMC even support all the features of the language? SSE? No support in D, why would it work in DMC?


> - 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).
>

Why not use this instead of Optlink if it works?
I'll check it out... though VisualD doesn't support this.


> - Use the Digital Mars COFF2OMF tool to convert to lib to OMF. Unfortunately, the tool isn't free, but IIRC it's inexpensive.
>

Seriously... I just simply won't bother, and write my app in C instead ;)


> - Use LDC or GDC instead of DMD. I think those work with COFF.
>

VisualD doesn't support those compilers (yet).

- 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).
>

I could probably build my engine as a DLL... I've been planning to do this
for a long time anyway.
Maybe this is the extra bit of motivation I need to do it ;)


> 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.
>

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.


January 06, 2012
On Friday, 6 January 2012 at 19:20:35 UTC, Manu wrote:
> The link must
> surely be the simplest+easiest of those 3 jobs...?

The painful part is more getting dmd to output coff than
writing a linker (can always use a third party linker anyway).

Adding coff support is a bit of a mess and super tedious.


I've been thinking porting the coff outputter from something
like nasm might be a good strategy, but I haven't figured out
how to start that yet.

January 06, 2012
On 1/6/2012 10:27 AM, Manu wrote:
> 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?

With DMD comes the various *.lib files converted to OMF format. Converting them is pretty simple.

Long term, I hope to get a better solution, but this is where we're at at the moment.
January 06, 2012
>> - Link with Unilink instead of DMD/Optlink.
> Why not use this instead of Optlink if it works?
> I'll check it out... though VisualD doesn't support this.

Cause its status is.. nebulous.
Closed-source, no homepage, just an ftp.
You have no guarantee it doesn't get abandoned one day.
Also what if there are blocking bugs and the author is away for some time?

>> - Use the Digital Mars COFF2OMF tool to convert to lib to OMF.
>> Unfortunately, the tool isn't free, but IIRC it's inexpensive.
> Seriously... I just simply won't bother, and write my app in C instead ;)

Exactly. That's what people will do/do/have already done.

> I could probably build my engine as a DLL... I've been planning to do this for a long time anyway.
> Maybe this is the extra bit of motivation I need to do it ;)

Good practice anyway. Code should always be modular.
January 06, 2012
Am 06.01.2012, 20:26 Uhr, schrieb Walter Bright <newshound2@digitalmars.com>:
> Long term, I hope to get a better solution, but this is where we're at at the moment.

What's the current state of the plan?
Can we hope for a switch to COFF?
January 06, 2012
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.

-- 
Adam Wilson
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/
« First   ‹ Prev
1 2 3 4 5 6 7 8