www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Systems programming

reply "Andreas Kochenburger" <akk privat.de> writes:
Is D really suitable for systems programming, despite its inline assembler?

What is the smallest executable size in Win or Linux?

Where can I find a minimum stub?

Andreas
-----
Beware of mad dogs and retired state employees.
Sep 14 2006
next sibling parent reply nobody <nobody mailinator.com> writes:
Andreas Kochenburger wrote:
 Is D really suitable for systems programming, despite its inline assembler?
 
In the DMD compiler the inline assembler has to be explicitly enabled with the -inline argument: http://digitalmars.com/d/dcompiler.html I can't say anything about the smallest executable size.
Sep 14 2006
parent reply James Pelcis <jpelcis gmail.com> writes:
nobody wrote:
 Andreas Kochenburger wrote:
 Is D really suitable for systems programming, despite its inline 
 assembler?
Yes. The larger the project, the more D will help.
 In the DMD compiler the inline assembler has to be explicitly enabled 
 with the -inline argument:
 
 http://digitalmars.com/d/dcompiler.html
Using -inline doesn't enable the inline assembler. If the compiler supports it and you are using the right architecture, the inline assembler is automatically enabled. Using -inline gets rid of small functions by essentially transforming the function call into the code of the function.
Sep 14 2006
parent nobody <nobody mailinator.com> writes:
James Pelcis wrote:
 nobody wrote:
 Andreas Kochenburger wrote:
 Is D really suitable for systems programming, despite its inline 
 assembler?
Yes. The larger the project, the more D will help.
 In the DMD compiler the inline assembler has to be explicitly enabled 
 with the -inline argument:
Using -inline doesn't enable the inline assembler. If the compiler supports it and you are using the right architecture, the inline assembler is automatically enabled. Using -inline gets rid of small functions by essentially transforming the function call into the code of the function.
Thanks for the reply. I completely misread the OP. You are absolutely right.
Sep 14 2006
prev sibling next sibling parent reply clayasaurus <clayasaurus gmail.com> writes:
Andreas Kochenburger wrote:
 Is D really suitable for systems programming, despite its inline assembler?
 
 What is the smallest executable size in Win or Linux?
 
 Where can I find a minimum stub?
The smallest exe size I got on win with dmd v.166 is 65 KB using --- int main() { return 0; } ---
Sep 14 2006
parent reply "Andreas Kochenburger" <akk privat.de> writes:
"clayasaurus" <clayasaurus gmail.com> schrieb im Newsbeitrag 
news:eecf69$1p6n$1 digitaldaemon.com...
 The smallest exe size I got on win with dmd v.166 is 65 KB using

 ---
 int main()
 {
   return 0;
 }
I would guess this is due to some statical linkage. In theory the exe should not be larger than a few k, depending on the PE header structure, but I am no expert in that. Andreas
Sep 15 2006
parent Pragma <ericanderton yahoo.removeme.com> writes:
Andreas Kochenburger wrote:
 "clayasaurus" <clayasaurus gmail.com> schrieb im Newsbeitrag 
 news:eecf69$1p6n$1 digitaldaemon.com...
 The smallest exe size I got on win with dmd v.166 is 65 KB using

 ---
 int main()
 {
   return 0;
 }
I would guess this is due to some statical linkage. In theory the exe should not be larger than a few k, depending on the PE header structure, but I am no expert in that. Andreas
You'd be correct in that guess. Near as I can tell, nobody has tried unpacking the rudimentary libs that DMD (windows) tends to link in: phobos.lib and snn.lib. I bet that if you unpack those lib files, and feed only the .obj files needed to the linker, you'd end up with a smaller program. Either that, or there's a design flaw in the D runtime that pulls in a *lot* of un-needed code. (I seem to recall a debate between Walter and Kris on that very topic a while back... I think printf could be the culprit.) -- - EricAnderton at yahoo
Sep 15 2006
prev sibling parent Pragma <ericanderton yahoo.removeme.com> writes:
Andreas Kochenburger wrote:
 Is D really suitable for systems programming, despite its inline assembler?
I think so. D takes on some bloat due to the GC support and TypeInfo. I'd consider those fair trade-offs as you probably wouldn't be using D if not at least for the GC.
 Where can I find a minimum stub?
Andreas, have you given Ares a try yet? I think that comprises the most minimal stub for D so far: http://www.dsource.org/projects/ares Granted, this will likely net you the largest gains on the Windows side of the house. Aside from that, there's probably some gains to be made with GDC, and playing around with GCC's optimizations and whatnot, but I'm a complete n00b in that area. :( -- - EricAnderton at yahoo
Sep 14 2006