www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Linking DMD objs with Microsoft's link.exe

reply "Lionello Lunesu" <lio remove.lunesu.com> writes:
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. 
Nov 25 2005
next sibling parent reply Don Clugston <dac nospam.com.au> writes:
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:

 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.
Nov 25 2005
parent "Lionello Lunesu" <lio remove.lunesu.com> writes:
"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.
Nov 27 2005
prev sibling next sibling parent "Unknown W. Brackets" <unknown simplemachines.org> writes:
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. 
 
 

Nov 25 2005
prev sibling parent reply "Walter Bright" <newshound digitalmars.com> writes:
"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

 were standard?

The DMC++ .obj's are standard. The problem is people keep creating new "standards" :-(
Nov 25 2005
parent "Lionello Lunesu" <lio remove.lunesu.com> writes:
"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.
Nov 27 2005