On 12 January 2015 at 08:46, Mike via Digitalmars-d
<[email protected]> wrote:
> On Monday, 12 January 2015 at 05:59:36 UTC, NVolcz wrote:
>>
>> Can this be done in D? How easy is it? What about the runtime?
>>
>>
>> https://www.reddit.com/r/programming/comments/2s1sgg/151byte_static_linux_binary_in_rust/
>>
>
> Here's a link to my 56 byte "Hello, World!" program for the ARM Cortex-M
> platform in D. And, if I only used the string "Hello!" like the rust
> example, I believe it would be 47 bytes.
>
> http://goo.gl/qWhpVX
>
> Mike
>
Without performing any linker magic.
root@f6e559d2d853:~# cat > small.d << EOF
import core.stdc.stdio;
import core.stdc.stdlib;
extern(C) void main()
{
printf("Hello!\n");
exit(0);
}
EOF
root@f6e559d2d853:~# gdc -frelease -Os -nophoboslib
-fno-emit-moduleinfo -nostdlib --entry=main small.d -lc -o small
root@f6e559d2d853:~# wc -c small
2488 small
root@f6e559d2d853:~# ./small
Hello!