www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Why do we still need/use .di 'header' files?

reply Lionello Lunesu <lio lunesu.remove.com> writes:
Wouldn't it be possible to make a tool that dumps the symbols from 
objs/libs, undoing any name-decoration?

And wouldn't it be possible to built that tool right into the compiler?

I don't know if protection attributes are being encoded in a decorated 
name, but that issue wouldn't be hard to overcome.

L.
Nov 17 2006
parent reply Don Clugston <dac nospam.com.au> writes:
Lionello Lunesu wrote:
 Wouldn't it be possible to make a tool that dumps the symbols from 
 objs/libs, undoing any name-decoration?
 
 And wouldn't it be possible to built that tool right into the compiler?
 
 I don't know if protection attributes are being encoded in a decorated 
 name, but that issue wouldn't be hard to overcome.
 
 L.

Protection attributes and many other things are not in the decorated names. What about templates, and conditional compilation?
Nov 17 2006
next sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Don Clugston" <dac nospam.com.au> wrote in message 
news:ejkbnm$1qb1$1 digitaldaemon.com...
 Protection attributes and many other things are not in the decorated 
 names.
 What about templates, and conditional compilation?

This is why there needs to be a "D object file" format.. :P That would be a killer feature IMO.
Nov 17 2006
next sibling parent "John Reimer" <terminal.node gmail.com> writes:
On Fri, 17 Nov 2006 07:17:41 -0800, Jarrett Billingsley  
<kb3ctd2 yahoo.com> wrote:

 "Don Clugston" <dac nospam.com.au> wrote in message
 news:ejkbnm$1qb1$1 digitaldaemon.com...
 Protection attributes and many other things are not in the decorated
 names.
 What about templates, and conditional compilation?

This is why there needs to be a "D object file" format.. :P That would be a killer feature IMO.

Totally agree with this! It would also shed a whole lot of other problems for D.
Nov 17 2006
prev sibling parent Chris Nicholson-Sauls <ibisbasenji gmail.com> writes:
Jarrett Billingsley wrote:
 "Don Clugston" <dac nospam.com.au> wrote in message 
 news:ejkbnm$1qb1$1 digitaldaemon.com...
 
Protection attributes and many other things are not in the decorated 
names.
What about templates, and conditional compilation?

This is why there needs to be a "D object file" format.. :P That would be a killer feature IMO.

It might kill C compatability in some cases... /but/ having such a thing, with perhaps a compiler switch to emit "legacy" object files, would be nice -- and would make DDL far, far simpler to implement I'm sure. -- Chris Nicholson-Sauls
Nov 17 2006
prev sibling next sibling parent reply BCS <BCS pathlink.com> writes:
Don Clugston wrote:
 What about templates, and conditional compilation?

if you are taking about closed source libs, that isn't an issue. It would be nice to have a tool that would walk a .o/.a/.lib file (that doesn't come with source) and generate a .di file that lets you link to it. Just dreaming I guess.
Nov 17 2006
next sibling parent Daniel Keep <daniel.keep.lists gmail.com> writes:
BCS wrote:
 Don Clugston wrote:
 What about templates, and conditional compilation?

if you are taking about closed source libs, that isn't an issue. It would be nice to have a tool that would walk a .o/.a/.lib file (that doesn't come with source) and generate a .di file that lets you link to it. Just dreaming I guess.

If the object file was compiled by D, it shouldn't be too hard. As Don said, you won't get templates, conditional compilation switches, protection attributes, etc., but it should work in general. But if that bugger's got C linkage, forget it. C linkage tells you the name and nothing more. And since in C the callee cleans up the stack, you can't even reliably disassemble the ASM to work out what kinds of arguments it takes (at least, not to my knowledge.) <2> Maybe what would work is if we defined a wrapper format, like DDL files, that takes the generated object file (of whatever format the native machine supports), and wraps it with additional information. That, or we could just get DDL built into the standard D toolchain. (Also just dreaming :P) </2> -- Daniel -- Unlike Knuth, I have neither proven or tried the above; it may not even make sense. v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
Nov 17 2006
prev sibling parent Don Clugston <dac nospam.com.au> writes:
BCS wrote:
 Don Clugston wrote:
 What about templates, and conditional compilation?

if you are taking about closed source libs, that isn't an issue.

No, I wasn't. Just pointing out that source->obj is a lossy process, it's not fully reversible (unless you include most of the source in the obj file, which I think defeats most of the purpose). It
 would be nice to have a tool that would walk a .o/.a/.lib file (that 
 doesn't come with source) and generate a .di file that lets you link to it.
 
 Just dreaming I guess.

Nov 19 2006
prev sibling parent "Lionello Lunesu" <lionello lunesu.remove.com> writes:
"Don Clugston" <dac nospam.com.au> wrote in message 
news:ejkbnm$1qb1$1 digitaldaemon.com...
 Protection attributes and many other things are not in the decorated 
 names.
 What about templates, and conditional compilation?

If you depend heavily on templates/conditional compilation, you'd be forced to release the source, and that makes sense. But what if I have a old-school lib with no need for templates? OT: I'm really afraid that D's dropping old-school, and going all fancy with meta-programming'n'shit. Frankly, I don't want to write meta-code that will then generate code for the compiler to compile... Templates are nice, but everything should also be possible without them... L.
Nov 17 2006