www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Creating a binary?

reply Peter Thomassen <info peter-thomassen.de> writes:
Hi,

when compiling file.d using dmd, file begins like this:

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)

I think this is the reason why D programs are that big ... why aren't
binaries created?

Peter
Aug 15 2006
parent reply Lars Ivar Igesund <larsivar igesund.net> writes:
Peter Thomassen wrote:

 Hi,
 
 when compiling file.d using dmd, file begins like this:
 
 ELF Header:
   Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
   Class:                             ELF32
   Data:                              2's complement, little endian
   Version:                           1 (current)
 
 I think this is the reason why D programs are that big ... why aren't
 binaries created?
 
 Peter

Ehm, this seems like the pretty printed version of an ELF header (which is stored binary btw), much like the one produced by analytical programs like readelf. All ELF binaries (whether executables, shared libs or object files) start like this. -- Lars Ivar Igesund blog at http://larsivi.net DSource & #D: larsivi
Aug 15 2006
parent reply Peter Thomassen <info peter-thomassen.de> writes:
Hi!

Lars Ivar Igesund schrieb am Dienstag, 15. August 2006 22:46:
 Ehm, this seems like the pretty printed version of an ELF header (which is
 stored binary btw), much like the one produced by analytical programs like
 readelf. All ELF binaries (whether executables, shared libs or object
 files) start like this.

I used less to view the compiled file, and obviously less passes the file through readelf or sth. Using cat file | less, everything looks binary :-) My mistake, sorry. Anyway: Why are (striped) binaries at least 150 KB of size, even when doing nothing (void main() { })? Thanks, Peter
Aug 15 2006
next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Peter Thomassen wrote:

 Anyway: Why are (striped) binaries at least 150 KB of size, even when doing
 nothing (void main() { })?

Phobos is statically linked. (for instance libstdc++ is usually dynamic) --anders
Aug 15 2006
prev sibling parent reply Hasan Aljudy <hasan.aljudy gmail.com> writes:
Peter Thomassen wrote:
 Hi!
 
 Lars Ivar Igesund schrieb am Dienstag, 15. August 2006 22:46:
 
Ehm, this seems like the pretty printed version of an ELF header (which is
stored binary btw), much like the one produced by analytical programs like
readelf. All ELF binaries (whether executables, shared libs or object
files) start like this.

I used less to view the compiled file, and obviously less passes the file through readelf or sth. Using cat file | less, everything looks binary :-) My mistake, sorry. Anyway: Why are (striped) binaries at least 150 KB of size, even when doing nothing (void main() { })? Thanks, Peter

150 KB is big?
Sep 13 2006
parent reply Oskar Linde <oskar.lindeREM OVEgmail.com> writes:
Hasan Aljudy wrote:
 
 
 Peter Thomassen wrote:
 Hi!

 Lars Ivar Igesund schrieb am Dienstag, 15. August 2006 22:46:

 Ehm, this seems like the pretty printed version of an ELF header 
 (which is
 stored binary btw), much like the one produced by analytical programs 
 like
 readelf. All ELF binaries (whether executables, shared libs or object
 files) start like this.

I used less to view the compiled file, and obviously less passes the file through readelf or sth. Using cat file | less, everything looks binary :-) My mistake, sorry. Anyway: Why are (striped) binaries at least 150 KB of size, even when doing nothing (void main() { })? Thanks, Peter

150 KB is big?

My latest stripped DMD (-O -release) generated binary had a code segment of 18 MB. On the other hand, binaries I write for microcontrollers is often smaller than 200 bytes (not using D of course). Everything is relative. :) /Oskar
Sep 13 2006
parent Hasan Aljudy <hasan.aljudy gmail.com> writes:
Oskar Linde wrote:
 Hasan Aljudy wrote:
 
 Peter Thomassen wrote:

 Hi!

 Lars Ivar Igesund schrieb am Dienstag, 15. August 2006 22:46:

 Ehm, this seems like the pretty printed version of an ELF header 
 (which is
 stored binary btw), much like the one produced by analytical 
 programs like
 readelf. All ELF binaries (whether executables, shared libs or object
 files) start like this.

I used less to view the compiled file, and obviously less passes the file through readelf or sth. Using cat file | less, everything looks binary :-) My mistake, sorry. Anyway: Why are (striped) binaries at least 150 KB of size, even when doing nothing (void main() { })? Thanks, Peter

150 KB is big?

My latest stripped DMD (-O -release) generated binary had a code segment of 18 MB. On the other hand, binaries I write for microcontrollers is often smaller than 200 bytes (not using D of course). Everything is relative. :) /Oskar

I have on my computer some anime movies of sizes 200 and 700 MB and more, so 150 KB seems so tiny.
Sep 13 2006