www.digitalmars.com         C & C++   DMDScript  

D - systems programming

reply Charles Banas <greywolf greyfade.net> writes:
i noticed in the DMD documentation that D can be used in systems 
programming, but it is only mentioned in the introduction, and never 
expounded on.

for example, i can't find information on setting the start point (as i can 
with GNU GCC's ld) of an executable, outputting a raw binary at link time, 
or linking to oject files compiled with a separate assembler.

stuff like that.

am i just not looking hard enough, forgetting something, or has no one ever 
tried using DMD in a systems context?

if anyone has tried using DMD this way, i'd appreciate knowing about it. :)

-- 
Charles "grey wolf" Banas
Mar 17 2003
parent reply "Walter" <walter digitalmars.com> writes:
"Charles Banas" <greywolf greyfade.net> wrote in message
news:oprl7p2ki78ctebf news.digitalmars.com...
 i noticed in the DMD documentation that D can be used in systems
 programming, but it is only mentioned in the introduction, and never
 expounded on.

 for example, i can't find information on setting the start point (as i can
 with GNU GCC's ld) of an executable,

That's a feature of the linker. See www.digitalmars.com/ctg/optlink.html
 outputting a raw binary at link time,

I don't know what you mean by this. The linker outputs an executable in PE format.
 or linking to oject files compiled with a separate assembler.

Easy, just specify the .obj files in the command to DMD.
Mar 19 2003
parent reply Charles Banas <greywolf greyfade.net> writes:
On Wed, 19 Mar 2003 01:21:06 -0800, Walter <walter digitalmars.com> wrote:

 That's a feature of the linker. See www.digitalmars.com/ctg/optlink.html

 outputting a raw binary at link time,

I don't know what you mean by this. The linker outputs an executable in PE format.

the extra step of stripping a PE.
 or linking to oject files compiled with a separate assembler.

Easy, just specify the .obj files in the command to DMD.

that, and i've never heard of OMF. (or, more accurately, i've never seen anything that supports it.) -- Charles "grey wolf" Banas
Mar 19 2003
parent reply "Walter" <walter digitalmars.com> writes:
"Charles Banas" <greywolf greyfade.net> wrote in message
news:oprma8t3z58ctebf news.digitalmars.com...
 outputting a raw binary at link time,

PE format.


 the extra step of stripping a PE.

The LD "bin" format, if for windows32, is likely a PE (portable executable) file.
 or linking to oject files compiled with a separate assembler.


that, and i've never heard of OMF. (or, more accurately, i've never seen anything that supports it.)

The object file format used by D and the linker is OMF (Object Module Format). It's a standard put out by Intel.
Mar 20 2003
parent reply Charles Banas <greywolf greyfade.net> writes:
On Thu, 20 Mar 2003 15:27:50 -0800, Walter <walter digitalmars.com> wrote:


 The LD "bin" format, if for windows32, is likely a PE (portable 
 executable)
 file.

such a thing exists) without the extra 100-byte header.
 or linking to oject files compiled with a separate assembler.


that, and i've never heard of OMF. (or, more accurately, i've never seen anything that supports it.)

The object file format used by D and the linker is OMF (Object Module Format). It's a standard put out by Intel.

Borland's. i don't have access to Intel's. i never ceases to amaze me when some standards are never used by everyone. since i work on multiple platforms, i need the ability to work with more common object file formats (like elf and coff) and to output a raw 32-bit binary file (with no header, relocation, or segment data) for my project. i guess i'll have to wait for the GCC frontend before i can use D. suck. -- Charles "grey wolf" Banas
Mar 20 2003
next sibling parent reply Roberto Mariottini <rmariottini lycosmail.com> writes:
Charles Banas wrote:
 On Thu, 20 Mar 2003 15:27:50 -0800, Walter <walter digitalmars.com> wrote:

 The object file format used by D and the linker is OMF (Object Module
 Format). It's a standard put out by Intel.

Borland's. i don't have access to Intel's. i never ceases to amaze me when some standards are never used by everyone.

Also Microsoft's should support that, at least for backward compatibility, since MASM can output also OMF object files. So we have at least 3 multinational companies that uses this standard.
 since i work on multiple platforms, i need the ability to work with more 
 common object file formats (like elf and coff) and to output a raw 
 32-bit binary file (with no header, relocation, or segment data) for my 
 project.  i guess i'll have to wait for the GCC frontend before i can 
 use D.  suck.

I think you'll need a _backend_ not a _frontend_. Have you tried the linux D compiler? Or you can write your own backend, since the frontend sources are public. Ciao
Mar 21 2003
parent Charles Banas <greywolf greyfade.net> writes:
On Fri, 21 Mar 2003 09:13:10 +0100, Roberto Mariottini 
<rmariottini lycosmail.com> wrote:

 since i work on multiple platforms, i need the ability to work with more 
 common object file formats (like elf and coff) and to output a raw 32- 
 bit binary file (with no header, relocation, or segment data) for my 
 project.  i guess i'll have to wait for the GCC frontend before i can 
 use D.  suck.

I think you'll need a _backend_ not a _frontend_. Have you tried the linux D compiler? Or you can write your own backend, since the frontend sources are public.

the linux D compiler, as it is, is still too early in the alpha stages to be of any use to me. i'd rather use something more mature like GCC or the existing win32 D compiler than this. even if only for experimentation. -- Charles "grey wolf" Banas
Mar 22 2003
prev sibling next sibling parent reply "Sean L. Palmer" <seanpalmer directvinternet.com> writes:
"Charles Banas" <greywolf greyfade.net> wrote in message
news:oprmdipc0b8ctebf news.digitalmars.com...
 On Thu, 20 Mar 2003 15:27:50 -0800, Walter <walter digitalmars.com> wrote:
 and the only other two linkers that seem to support it are Intel's and
 Borland's.  i don't have access to Intel's.  i never ceases to amaze me
 when some standards are never used by everyone.

It's because Microsoft wants to own all the standards. Sean
Mar 21 2003
parent Charles Banas <greywolf greyfade.net> writes:
On Fri, 21 Mar 2003 10:44:05 -0800, Sean L. Palmer 
<seanpalmer directvinternet.com> wrote:

 "Charles Banas" <greywolf greyfade.net> wrote in message
 news:oprmdipc0b8ctebf news.digitalmars.com...
 On Thu, 20 Mar 2003 15:27:50 -0800, Walter <walter digitalmars.com> 
 wrote:
 and the only other two linkers that seem to support it are Intel's and
 Borland's.  i don't have access to Intel's.  i never ceases to amaze me
 when some standards are never used by everyone.

It's because Microsoft wants to own all the standards.

-- Charles "grey wolf" Banas
Mar 22 2003
prev sibling parent reply "Walter" <walter digitalmars.com> writes:
"Charles Banas" <greywolf greyfade.net> wrote in message
news:oprmdipc0b8ctebf news.digitalmars.com...
 The object file format used by D and the linker is OMF (Object Module
 Format). It's a standard put out by Intel.

Borland's. i don't have access to Intel's. i never ceases to amaze me when some standards are never used by everyone.

OMF was the only one used on the PC by probably 50 compilers for about 12 years. It's a pretty well worn standard. The only compilers I know of that supports Microsoft's version of COFF is Microsoft's compilers.
 since i work on multiple platforms, i need the ability to work with more
 common object file formats (like elf and coff) and to output a raw 32-bit
 binary file (with no header, relocation, or segment data) for my project.
 i guess i'll have to wait for the GCC frontend before i can use D.  suck.

The PE format is pretty simple, and it shouldn't be too hard to write an EXE2BIN for it, assuming that you've programmed out any references to DLLs, etc.
Mar 21 2003
parent reply Charles Banas <greywolf greyfade.net> writes:
On Fri, 21 Mar 2003 15:27:24 -0800, Walter <walter digitalmars.com> wrote:

 "Charles Banas" <greywolf greyfade.net> wrote in message
 news:oprmdipc0b8ctebf news.digitalmars.com...
 The object file format used by D and the linker is OMF (Object Module
 Format). It's a standard put out by Intel.

Borland's. i don't have access to Intel's. i never ceases to amaze me when some standards are never used by everyone.

OMF was the only one used on the PC by probably 50 compilers for about 12 years. It's a pretty well worn standard. The only compilers I know of that supports Microsoft's version of COFF is Microsoft's compilers.

compilers are obsolete and OMF was pretty much replaced by ELF, COFF, et. al. and since i don't even use Microsoft's version of COFF (since i rarely use the MS compiler), your last statement held little meaning to me.
 since i work on multiple platforms, i need the ability to work with more
 common object file formats (like elf and coff) and to output a raw 32- 
 bit
 binary file (with no header, relocation, or segment data) for my 
 project.
 i guess i'll have to wait for the GCC frontend before i can use D.  
 suck.

The PE format is pretty simple, and it shouldn't be too hard to write an EXE2BIN for it, assuming that you've programmed out any references to DLLs, etc.

although i would like to write everything in D, my projects simply aren't ready for that, so i want to write certain modules in D. therefore, i want to use GCC for the majority of the project - and the object formats it supports. -- Charles "grey wolf" Banas
Mar 22 2003
parent Mark Evans <Mark_member pathlink.com> writes:
...use GCC for the majority of the project - and the object formats it 
supports.
Charles "grey wolf" Banas

I second the motion. Object formats are a problem with Digital Mars tools generally and the whole topic also folds into a Linux port of DMC++ which would be an absolute Godsend for Linux. Mark
Mar 22 2003