Jump to content
Welcome, welcome! Come in and register, and have some developer coffee. 👨‍💻 ×

Smallest "Hello World" Console App Comparisons


Recommended Posts

1. Free Pascal
Generate standalone console app for i386-Win32.

begin
       WriteLn('Visit Malaysia 2020');
end.

49,815 bytes EXE.

 

2. C# .NET
Generate .NET Framework dependent executable.

using System;

namespace N
{
   class Program
   {
       static void Main(string[] args)
       {
           Console.Write("Visit Malaysia 2020");
       }
   }
}

4,608 bytes EXE.

 

3. Flat Assembler
Generate standalone executable.

format PE console
entry start

include 'include\win32a.inc'

section '.data' data readable writable
    msg     db 'Visit Malaysia 2020',13,10,0
    len = $-msg
    dummy   dd ?

section '.code' readable writable executable

 start:

push STD_OUTPUT_HANDLE
call [GetStdHandle]         ;STD_OUTPUT_HANDLE (DWORD)-11

push 0           ;LPVOID  lpReserved
push dummy       ;LPDWORD lpNumberOfCharsWritten
push len         ;DWORD   nNumberOfCharsToWrite
push msg         ;VOID    *lpBuffer;
push eax         ;HANDLE  hConsoleOutput
call [WriteConsole]

push 0
call [ExitProcess]

section '.idata' data import readable writable

library kernel32,'KERNEL32.DLL'
include 'include\api\kernel32.inc'

2,048 bytes EXE.

 

4. C++
Generate CRT-dependent executable.

#include <iostream>

int main()
{
   std::cout << "Visit Malaysia 2020\n";
}

10,752 bytes EXE.

 

  • Love 1
Link to post
Share on other sites
On 4/5/2021 at 10:01 PM, Malkuth said:

I'm a huge fan of small executables. The FASM one is INSANE.

Yeah, and that executable produced by FASM has no dependency. It calls KERNEL32.dll directly.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...