Re: Problem Linking (win32)



But if your aim is to explore the Win API, then keep 'golink' but
steer clear of any C library.

----8<----

; nasm -f win32 -o go.obj go.asm
; golink /console go.obj kernel32.dll

section .bss

wrtn: resd 1

section .text

global start
extern ExitProcess
extern GetStdHandle
extern WriteFile

start:

push ebp
mov ebp, esp
sub esp, 4
mov al, 13
mov [ebp-4], al
mov al, 0x048
mov [ebp-3], al
mov al, 0x049
mov [ebp-2], al
mov al, 13
mov [ebp-1], al

push -11
call GetStdHandle

mov ebx, esp

push dword 0
push wrtn
push dword 4
push ebx
push eax
call WriteFile

push eax
call ExitProcess

---->8----

That will print "HI" to the console.

Nathan.

.



Relevant Pages