I'd recommend a read of Narue's tutorial, its a few posts down and is a brillaint intro to NASM on windows :)
I get it now. It doesn't know where to get the winAPI functions from.
I added this:
import MessageBoxA user32.dll
Still though, it's still pissing me about. There's so many annoying little things that don't work, yet should.
[extern MessageBoxA]
import MessageBoxA user32.dll
[global _main]
[segment .text]
_main:
push dword szText ; Push param onto stack
call box ; Call our function
add esp, 4 ; un-bork the stack?
ret
box:
enter 0,0
mov eax, [ebp+8] ; Pull first param off stack
push dword 0 ; MB_OK style
push dword eax ; First Param
push dword eax ; First Param
push dword 0 ; HWND parent (NULL)
call MessageBoxA
xor eax, eax
leave
ret
[segment .data]
szText: db 'Hello',0
if I link it with alink, I get this (which doesn't work):
C:\nasm-2.06rc1>nasm -o messagebox.obj -f obj messagebox.asm
C:\nasm-2.06rc1>c:\alink\alink.exe -oPE -subsys con messagebox.obj
ALINK v1.6 (C) Copyright 1998-9 Anthony A.J. Williams.
All Rights Reserved
Loading file messagebox.obj
matched Externs
matched ComDefs
Generating PE file messagebox.exe
Warning, no entry point specified
Error writing to file messagebox.exe
If I link it with gcc I get this:
C:\nasm-2.06rc1>nasm -o messagebox.obj -f obj messagebox.asm
C:\nasm-2.06rc1>c:\MinGW\bin\gcc.exe "C:\nasm-2.06rc1\messagebox.obj" -o size2.e
xe
C:\nasm-2.06rc1\messagebox.obj: file not recognized: File format not recognized
collect2: ld returned 1 exit status
What the hell's going? Is there any documentation online about compiling things in nasm?