View mode: basic / threaded / horizontal-split · Log in · Help
November 25, 2005
Linking DMD objs with Microsoft's link.exe
Hi,

I'm trying to link object files from DMD.exe using Microsoft's linker (the 
one from VS2005), but it gives:

D:\dmd>dmd -g -debug -c bla.d

D:\dmd>link /OUT:"bla.exe" /DEBUG /PDB:"bla.pdb" /SUBSYSTEM:CONSOLE 
/MACHINE:X86 bla.obj
Microsoft (R) Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation.  All rights reserved.

bla.obj : fatal error LNK1107: invalid or corrupt file: cannot read at 
0x14AF

I'm trying to do this in order to get a .pdb that VS can use for debugging. 
I have the impression that that the support for C7 debug information was 
removed from VS2005 (I remember the beta showed warnings "C7 will be 
removed!".)

I didn't really expect the pdb-generation to work, but I thought the .obj's 
were standard?

L.
November 25, 2005
Re: Linking DMD objs with Microsoft's link.exe
Lionello Lunesu wrote:
> Hi,
> 
> I'm trying to link object files from DMD.exe using Microsoft's linker (the 
> one from VS2005), but it gives:
<snip>
> I didn't really expect the pdb-generation to work, but I thought the .obj's 
> were standard?
> 
> L. 

Nope. DMD uses Intel's OMF format, Microsoft used to use OMF, but since 
the early 90's they use their own COFF format. Recent Linux stuff is ELF.
Besides, every C++ compiler uses its own name mangling. It's a mess.
November 25, 2005
Re: Linking DMD objs with Microsoft's link.exe
Can't gcc (gdc) compile to COFF?  If so, you could try using that 
compiler, which might work.

But the name mangling might indeed bite you.

-[Unknown]


> Hi,
> 
> I'm trying to link object files from DMD.exe using Microsoft's linker (the 
> one from VS2005), but it gives:
> 
> D:\dmd>dmd -g -debug -c bla.d
> 
> D:\dmd>link /OUT:"bla.exe" /DEBUG /PDB:"bla.pdb" /SUBSYSTEM:CONSOLE 
> /MACHINE:X86 bla.obj
> Microsoft (R) Incremental Linker Version 8.00.50727.42
> Copyright (C) Microsoft Corporation.  All rights reserved.
> 
> bla.obj : fatal error LNK1107: invalid or corrupt file: cannot read at 
> 0x14AF
> 
> I'm trying to do this in order to get a .pdb that VS can use for debugging. 
> I have the impression that that the support for C7 debug information was 
> removed from VS2005 (I remember the beta showed warnings "C7 will be 
> removed!".)
> 
> I didn't really expect the pdb-generation to work, but I thought the .obj's 
> were standard?
> 
> L. 
> 
>
November 26, 2005
Re: Linking DMD objs with Microsoft's link.exe
"Lionello Lunesu" <lio@remove.lunesu.com> wrote in message
news:dm6u0s$7n8$1@digitaldaemon.com...
> I didn't really expect the pdb-generation to work, but I thought the
.obj's
> were standard?

The DMC++ .obj's are standard. The problem is people keep creating new
"standards" :-(
November 28, 2005
Re: Linking DMD objs with Microsoft's link.exe
"Don Clugston" <dac@nospam.com.au> wrote in message 
news:dm70a2$9rs$1@digitaldaemon.com...
> Nope. DMD uses Intel's OMF format, Microsoft used to use OMF, but since 
> the early 90's they use their own COFF format. Recent Linux stuff is ELF.
> Besides, every C++ compiler uses its own name mangling. It's a mess.

Where exactly does the name mangling come in? DMD mangles one way, so if 
microsoft's linker (would have) understood DMD/C's object files, it would 
simply have used the already mangled names, right? And the debugger just 
finds the right debug info for the current memory location. Would I perhaps 
only get mangled names in the debugger in that case?

Does the debugger demangle the names, or does an obj contain both mangled 
and human-readable names?

L.
November 28, 2005
Re: Linking DMD objs with Microsoft's link.exe
"Walter Bright" <newshound@digitalmars.com> wrote in message 
news:dm8bc9$2fnf$1@digitaldaemon.com...
> The DMC++ .obj's are standard. The problem is people keep creating new
> "standards" :-(

"people", riiiiight ; )
Even if the .objs were OK, I guess the MS linker would never be able to 
generate its .pdb files, since even MS's compiler had different flags for 
pdb/C7 debug info. Is PDB microsoft only / open ?

L.
Top | Discussion index | About this forum | D home