0
    .string "Hello\n"
    .globl main
main:
    pushl %ebp
    movl %esp, %ebp
    pushl $hello
    call puts
    movl $0, %eax
    movl %ebp, %esp
    popl %ebp
    ret

This code works on 32bit Linux. How can I run this on Windows?

gcc hello.s

1 Answer 1

1

You need to find a Windows version of an x86 assembler. The GNU Assembler is available on Windows through the MinGW project. This is the same assembler you are using on Linux.

Sign up to request clarification or add additional context in comments.

2 Comments

undefined reference to puts, and WinMain@16 using mingw 4.8.1 x86
@JKS: I forget, but Windows name mangling might put an _ in front of C names. In that case, you'd need to call _puts. Aside from that, your code appears portable between the Linux and Windows 32bit ABIs. (Both use a stack-args calling convention).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.