| 1 | // vtest build: !(windows && gcc) // it declares its own `main` function, but on windows && gcc, it needs to be `wWinMain` |
| 2 | module no_main |
| 3 | |
| 4 | // Compile with: |
| 5 | // v -cc clang -prod -gc none -cflags '-s -fuse-ld=mold' -o hw examples/minimal_c_like_program_using_puts.v && ll hw && sstrip -z hw && ll hw |
| 6 | // With clang-10, on Ubuntu 20.04, it produces an executable with a size of 2331 bytes, after stripping. |
| 7 | // Note: the above uses sstrip 2.1 (from https://git.sr.ht/~breadbox/ELFkickers) and mold 2.32.0 (from https://github.com/rui314/mold). |
| 8 | |
| 9 | fn C.puts(const_msg &char) i32 |
| 10 | |
| 11 | @[export: 'main'] |
| 12 | fn hello() int { |
| 13 | C.puts(c'Hello world') |
| 14 | return 0 |
| 15 | } |
| 16 | |